Question

When using inverse Laplace uses the ilaplase module in Matlab. Below is an example for F(s) (5-5) F (S) = s(s+ 2)2 symsts F=(Use the symbolic tool in MATLAB to obtain the inverse Laplace for each of the following and graph both results F(s) and f(t)Using example for MATLAB code in part 2

0 0
Add a comment Improve this question Transcribed image text
Answer #1

syms t
syms s
syms Fa(s)
syms Fb(s)
syms Fc(s)
syms Fd(s)
syms Fe(s)

syms fa(t)
syms fb(t)
syms fc(t)
syms fd(t)
syms fe(t)


% for function (a)
Fa(s)=s/(s*(s+1)*(s+5));

% for function (b)
Fb(s)=(3*s+2)/(s^2+2*s+10);

% for function (c)
Fc(s)=(3*s^2+6*s+6)/((s+1)*(s^2+10));

% for function (d)
Fd(s)=exp(-s)/(s^2);


% for function (e)
Fe(s)=((s^2+3*s+10)*(s+5))/((s+3)*(s+4)*(s^2+2*s+100));

% inverse of laplace function (a)
f(t)=ilaplace(Fa);
fa(t)=simplify(f);

% inverse of laplace function (b)
f(t)=ilaplace(Fb);
fb(t)=simplify(f);

% inverse of laplace function (c)
f(t)=ilaplace(Fc);
fc(t)=simplify(f);

% inverse of laplace function (d)
f(t)=ilaplace(Fd);
fd(t)=simplify(f);

% inverse of laplace function (e)
f(t)=ilaplace(Fe);
fe(t)=simplify(f);


% pretty(f) of function (a)

fprintf('Inverse laplace for function (a)\n');
pretty(fa);

% pretty(f) of function (b)

fprintf('Inverse laplace for function (b)\n');
pretty(fb);

% pretty(f) of function (c)

fprintf('Inverse laplace for function (c)\n');
pretty(fc);

% pretty(f) of function (d)

fprintf('Inverse laplace for function (d)\n');
pretty(fd);

% pretty(f) of function (e)

fprintf('Inverse laplace for function (e)\n');
pretty(fe);


% for graph create T and S

T=linspace(0,10,101);
S=linspace(1,25,101);

% for corresponding f(t) using T [ for function (a) ]
fa_t=zeros(1,length(T));

% for corresponding f(t) using T [ for function (b) ]
fb_t=zeros(1,length(T));

% for corresponding f(t) using T [ for function (c) ]
fc_t=zeros(1,length(T));

% for corresponding f(t) using T [ for function (d) ]
fd_t=zeros(1,length(T));

% for corresponding f(t) using T [ for function (e) ]
fe_t=zeros(1,length(T));


% for corresponding F(s) using S [ for function (a) ]
Fa_s=zeros(1,length(S));

% for corresponding F(s) using S [ for function (b) ]
Fb_s=zeros(1,length(S));

% for corresponding F(s) using S [ for function (c) ]
Fc_s=zeros(1,length(S));

% for corresponding F(s) using S [ for function (d) ]
Fd_s=zeros(1,length(S));

% for corresponding F(s) using S [ for function (e) ]
Fe_s=zeros(1,length(S));


% calculate all f(t)
for c=1:length(T)
fa_t(c)=eval(fa(T(c)));
fb_t(c)=eval(fb(T(c)));
fc_t(c)=eval(fc(T(c)));
fd_t(c)=eval(fd(T(c)));
fe_t(c)=eval(fe(T(c)));
end


% calculate all F(s)
for c=1:length(S)
Fa_s(c)=eval(Fa(S(c)));
Fb_s(c)=eval(Fb(S(c)));
Fc_s(c)=eval(Fc(S(c)));
Fd_s(c)=eval(Fd(S(c)));
Fe_s(c)=eval(Fe(S(c)));
end


% plot f(t) and F(s) for (a)
figure(1)
subplot(1,2,1);
plot(T,fa_t);
ylabel('f(t)');
xlabel('t');
title('f(t) vs t for (a)');

subplot(1,2,2);
plot(S,Fa_s);
ylabel('F(s)');
xlabel('s');
title('F(s) vs s for (a)');


% plot f(t) and F(s) for (b)
figure(2)
subplot(1,2,1);
plot(T,fb_t);
ylabel('f(t)');
xlabel('t');
title('f(t) vs t for (b)');

subplot(1,2,2);
plot(S,Fb_s);
ylabel('F(s)');
xlabel('s');
title('F(s) vs s for (b)');

% plot f(t) and F(s) for (c)
figure(3)
subplot(1,2,1);
plot(T,fc_t);
ylabel('f(t)');
xlabel('t');
title('f(t) vs t for (c)');

subplot(1,2,2);
plot(S,Fc_s);
ylabel('F(s)');
xlabel('s');
title('F(s) vs s for (c)');


% plot f(t) and F(s) for (d)
figure(4)
subplot(1,2,1);
plot(T,fd_t);
ylabel('f(t)');
xlabel('t');
title('f(t) vs t for (d)');

subplot(1,2,2);
plot(S,Fd_s);
ylabel('F(s)');
xlabel('s');
title('F(s) vs s for (d)');

% plot f(t) and F(s) for (e)
figure(5)
subplot(1,2,1);
plot(T,fe_t);
ylabel('f(t)');
xlabel('t');
title('f(t) vs t for (e)');

subplot(1,2,2);
plot(S,Fe_s);
ylabel('F(s)');
xlabel('s');
title('F(s) vs s for (e)');

f(t) vs t for (b) F(s) vs s for (b) 0.45 0.4 0.35 0.3 F(S) 0.25 0.2 0.15 0 2 4 6 8 10 O 5 10 15 20 25

f(t) vs t for (c) F(s) vs s for (c) f(t) F(s) R 4 6 8 10 0 5 10 15 20 25

f(t) vs t for (d) F(s) vs s for (d) f(t) F(s) 0.05 0 2 4 6 8 10 0 5 10 15 20 25 S

f(t) vs t for (e) F(s) vs s for (e) 0.055 0.05 0.045 f(t) 0.04 0.035 -0.6 0.03 -0.84 0 2 4 6 8 10 0 5 10 15 20 25

f(t) vs t for (a) F(s) vs s for (a) 0.14 0.09 0.12 0.07 0.06 0.05 F(s) 0.04 0.02 0.01 0 2 4 6 8 10 do 5 10 15 20 25 S

Add a comment
Know the answer?
Add Answer to:
Using example for MATLAB code in part 2 When using inverse Laplace uses the ilaplase module...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT