I'm currently working on an assignment where we want to plot an output function.
Since our input signal( v(t) )is in the Time domain and our transfer function ( H(s) ) is in the S domain. we want to bring our input signal to the S domain so we can simply use multiplication and then bring it back to the time domain to plot.
The error I'm getting is: Error using plot Data must be numeric, datetime, duration or an array convertible to double.
syms s C R L T n
C = (36)*10^(-6); % Our given values for capacitance, inductance and resistance
L = 0.18;
R = 100;
T = 1/50; % Period
H = 1/(C*R*s + C*L*s^2 + 1); %Transfer function
y = 3/2; %c_0
for n = -5:1:5
c_k = (((-1)^n)/(pi*(2*n+1)))*exp(1i*(2*n+1)*100*pi*t);
y = y + c_k;
end
V = laplace(y);
Vc = V * H;
vc = ilaplace(Vc);
vpa(vc);
plot(t,vc);```
I see different issues in this RLC filter circuit.
Here are the modifications you should operate at the end of your program:
You have to change types : "syms" type has to be converted into "string" type
You have to convert to real.
"t" is symbolic: Matlab cannot use it as it is; you know that you must give to $t$ a range of values, for example $t=-1:0.1:1$.
We use here the so-called "immediate definition" of a function (https://uk.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html)
What is this function $y$ ? It looks like a truncated Fourier series expansion of a ramp function ?
vpa(...) isn't useful. Instead of for example $2/3$, it gives you $0.66666666666666666666666666...$ with thirty decimals... It's better to keep the fractional form.
The value of T isn't used.