Possible Inverse Laplace Transform Error?
显示 更早的评论
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 个评论
madhan ravi
2020-7-9
Could you press the code button to format your code? It’s unreadable.
Rocky Gonzalez
2020-7-9
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!