this is my code:
component rc1
% rc1
% Component automatically generated from a SPICE netlist for subcircuit RC1.
% MATLAB version: 23.2.
% Simscape Electrical version: 23.2.
% Simscape code generated on: 07-Nov-2023 18:37:14
nodes
node_1 = foundation.electrical.electrical; % node_1
end
nodes(Access=protected, ExternalAccess=none)
node_2 = foundation.electrical.electrical;
end
annotations
UILayout = [
UIGroup('Parasitic elements', ...
specifyParasiticValues, capacitorSeriesResistance)
UIGroup('Smoothing functions', ...
specifySmoothValues, aWarning, expXh, expXl)
]
end
parameters
specifyParasiticValues = ee.enum.include.no; % Specify parasitic values
end
parameters(ExternalAccess=none)
capacitorSeriesResistance = {0, 'Ohm'}; % Capacitor parasitic series resistance
end
if specifyParasiticValues == ee.enum.include.yes
annotations
[capacitorSeriesResistance] : ExternalAccess=modify;
end
end
parameters
specifySmoothValues = ee.enum.include.no; % Specify function smooth parameters
end
parameters(ExternalAccess=none)
aWarning = ee.enum.include.no; % Include warning
expXh = {Inf, '1'}; % Upper boundary of linear extrapolation for exp(x), typical x=80
expXl = {-Inf, '1'}; % Lower boundary of linear extrapolation for exp(x), typical x=-80
end
if specifySmoothValues == ee.enum.include.yes
annotations
[aWarning, expXh, expXl] : ExternalAccess=modify;
end
end
components(ExternalAccess=observe)
R1 = foundation.electrical.elements.resistor(R={(1*1000),'Ohm'});
C_CGD1 = foundation.electrical.elements.capacitor(c={(0.5*simscape.function.expm(value(node_2.v,'V'), ...
expXl, expXh, aWarning)),'F'},r=capacitorSeriesResistance,g={0,'1/Ohm'},vc.priority=priority.none);
end
connections
connect(R1.p,node_1);
connect(R1.n,node_2);
connect(C_CGD1.p,node_2);
connect(C_CGD1.n,*);
end
end