How do I make a CPE (constant phase element) with Simscape language?
You can write a custom component:



component CPE

%   The rest of the comment shows up as the component explanation.
nodes %conserving ports
 p = foundation.electrical.electrical; % +:top
 n = foundation.electrical.electrical; % -:bottom


end
nodes(Access=private)
 n1 = foundation.electrical.electrical; 
 n2 = foundation.electrical.electrical; 

end
% These ports show up in the block diagram.  The comments immediately after the domain declaration controls the displayed name and location of the ports in the block diagram
parameters
 Rs = { 1, 'Ohm' }; % Rs
 Rt = {2, 'Ohm'};   % Rt
 Q = {2, '1'};   % Q is unitless 
 Aw = {2, '1'};   % Aw is unitless 

end

variables(Access=public)
 i = { 0, 'A' };  % Current
%  v = { 0, 'V' };  % Voltage
 Zcpe = { 1, 'ohm' }; % 
 Zw = { 0.75, 'ohm' }; % 

end

function setup  

    n1.v =  {value={0, 'V'},priority=priority.high};
    n2.v =  {value={0, 'K'},priority=priority.high};

end

% Parameter validation. These branches are half of the equations, 
%the other half go in the equations section, there can only be an
% equal number of branch equations + equations = variables.
branches
    i1  : p.i -&gt; n1.i;
    i3  : n1.i -&gt; n.i;
    i2  : n1.i -&gt; n2.i;
%   i2a  : n2.i -&gt; n.i; %may not need this one, might want to eliminate node n2 and go straght from n1 to n



end



equations

 let 



     v = p.v - n1.v;
     v2 = n1.v - n.v;
     v3 = n1.v - n.v;
 in

    v ==  i1*Rs; % Voltage equation
    i1 == i2 + i3;
    Zcpe*Zcpe * -Q*w ==  1; %This will also need to be converted to a differential equation this is just an example
    %The equation is rewritten as follows Zcpe == 1/Q/(j*w); 
    %to this by squaring both sides Zcpe*Zcpe == -1/(Q*Q*w*w); to this Zcpe*Zcpe *(Q*Q*w*w) ==1; 

    %write the Zw equation the same but square it twice Zw*Zw*Zw*Zw == -4*Aw*Aw*Aw*Aw/(w*W);
    Zw*Zw*Zw*Zw*w*w == -4*Aw*Aw*Aw*Aw; %This will also need to be converted to a differential equation this is just an example
    v2 == i2*Zcpe;
    v3 == i3*(Rt+Zw);


 end

end % equations


end %component  I miss the curly braces...


This code isn't even close to being workable, remember, this took a small amount of my time so I hope you have some appreciation for it (and vote accordingly). Writing custom components isn't easy and it will take a few weeks of pulling your hair out in frustration before you understand the concepts to make this work. There is one concept I don't understand that you will need to fill in, and thats adding in the differential equations, this custom component is an example. Simscape does do s-paramters

I had to pour through the documentation about 4 times and try simple examples before I could work my way up to a full component with many nodes. The first thing I would do is get only the Zcpe component working and tested as a custom component, then work your way up. If you can get Zcpe, you can get everything working.