Possible Inverse Laplace Transform Error?

7 views (last 30 days)
Rocky Gonzalez
Rocky Gonzalez on 9 Jul 2020
Edited: Rocky Gonzalez on 9 Jul 2020
Hello,
I get an error: "Undefined function or variable 's'."
I am not too sure why. I am wondering if this is due to symbolic notation of the inverse laplace transform (even though I converted the equation into function notation). I am trying to compute an inverse laplace transform so I can plot 'Vb' as the y-axis and 't' as the x-axis. I defined 's' to have a value without any luck. Here is my code that is able to reproduce this error. I am also not sure if laplace domain equation is 'too' complicated to compute. If so, are there any alternatives to consider for computing an numerical approximation for an inverse laplace transform? Thank you in advance.
Program:
% Written: Rocky Y. Gonzalez (07/09/2020)
% University of Nevada Las Vegas
% Department of Electrical and Computer Engineering
% Program: N/A
clear all, close all, clc
% Variables ---------------------------------------------------------------
V0 = 5000;
Rtotal = 50;
ic = V0/Rtotal;
Rd = 0;
Gd = 0;
Ld = 6E-6;
Cd = 12E-9;
C = 3.3E-6;
Rs = Rtotal;
Rf = 1E9;
RL = 1E9;
la = 12;
lb = 22;
z = 22;
% Laplace Domain Equations ------------------------------------------------
syms s
Z0 = sqrt((s*Ld+Rd)/(s*Cd+Gd));
Z0a = Z0;
Z0b = Z0;
gamma = sqrt((s*Ld+Rd)*(s*Cd+Gd));
Zina = Z0a*(RL*cosh(gamma*la) + Z0a*sinh(gamma*la))/...
(RL*sinh(gamma*la) - Z0a*cosh(gamma*la));
ZLb = (Rf*Zina)/(Rf+Zina);
Zinb = Z0b*(ZLb*cosh(gamma*lb) + Z0b*sinh(gamma*lb))/...
(Z0b*sinh(gamma*lb) - Z0b*cosh(gamma*lb));
Qb_plus = (2*V0*Z0b*(ZLb+Z0b)*C)/...
((1+s*(Rs+Zinb)*C)*(ZLb*sinh(gamma*lb) + Z0b*cosh(gamma*lb)));
Qb_minus = Qb_plus*(ZLb-Z0b)/(ZLb+Z0b);
Qa_plus = Qb_plus*(RL+Z0a)*ZLb/...
((ZLb-Z0b)*(RL*cosh(gamma*la) + Z0a*sinh(gamma*la)));
Qa_minus = Qa_plus*(RL-Z0a)/(RL+Z0a);
Vb = (Qa_plus*exp(-gamma*(z-la)) + Qa_minus*exp(gamma*(z-la)))/2;
% Inverse Laplace Transforming / Plotting ---------------------------------
t = 0:1:2;
figure(1)
Vb = simplify(Vb, 'Steps',20);
Vb = vpa(Vb, 5)
vb = ilaplace(Vb)
vb_ = matlabFunction(vb)
s = 1
plot(t,vb_(t))
  2 Comments
madhan ravi
madhan ravi on 9 Jul 2020
Could you press the code button to format your code? It’s unreadable.
Rocky Gonzalez
Rocky Gonzalez on 9 Jul 2020
I had a feeling there was a functionality to convert the code's format. Sorry about that, just fixed now!

Sign in to comment.

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!