Plotting a response of a circuit on Matlab

Thread Starter

tquiva

Joined Oct 19, 2010
176
I'm currently working on this assignment:


I found the transfer function to be:



I am now on part (f) of the problem:
I am quite unsure of how to go about solving this in Matlab. I have the following code:

Rich (BB code):
syms s t R real C real;
R = 3 - sqrt(2);
H = (1+R)/(3+s*(4*C+R*C)+s^2*C^2);
in1 = heaviside(t) - heaviside(t-8*pi/C);
IN = laplace(in1,t,s);
OUT1 = IN*H;
out1 = ilaplace(OUT1,s,t)*heaviside(t+eps);
ezplot(subs(out1,R,sqrt(2)),[-1/25]),hold on, legend('R=sqrt(2)'), xlabel('t'),ylabel('out(t)'),title('Response for in1(t)')
in2 = cos(3*C*t)*in1;
IN2 = laplace(in2,t,s);
OUT2 = IN*H;
out2 = ilaplace(OUT2,s,t)*heaviside(t+eps);
ezplot(subs(out2,R,1.414),[-1/25]),hold on, legend('R=sqrt(2)'), xlabel('t'),ylabel('out(t)'),title('Response for in2(t)')
I then get an error that says:

??? Error using ==> ezplot>ezparam at 392
Cannot plot parametrized surfaces. Try ezsurf.

Error in ==> ezplot at 163
hp = ezparam(cax,f{1},f{2},vars,labels,args{2:end});

Error in ==> sym.ezplot at 50
h = ezplot(char(f),char(y));


Right now, I'm really unsure of how to fix this and my assignment is due in a few hours. Could someone please help me asap? Any help is greatly appreciated.
 

Attachments

Georacer

Joined Nov 25, 2009
5,182
I doesn't seem related to the error message, but ezplot can't generate a graph out of an expression with more than one independent sym variable.

You can see that out1 and out2 are functions of C, s and t by typing:
symvar(out1)

The problem lies with Matlab's inability to return OUT1 fully back to the time domain. You can see some ilaplace function call residuals in the out1, if you examine it.

Maybe that problem is rooted back in the IN function that has left the laplace(heaviside... function intact. Try to calculate that Laplace transform by hand and insert it manually in the IN function.

P.S. I don't know what to think about this, but Matlab returns 1 as the inverse Laplace transformation of 1/s.
 
Top