I want to find the inverse Laplace transform and then plot the graph. Below ๐Ÿ‘‡ is the code: syms s t %defines s and t as symbolic variables.
a=0.05;
b=0.0045;
c=0.067;
f=0.0508;
g=0.2;
h=0.45;
x=2.71828;
j=232679478;
r=0.742;
k=(h+r);
F =(1-g)*b*a*j*x^(c+f))/s*(s+a*x^c)(s+b*x^f) + (r*a*j*g*b*x^(c+f))/s*(s+k)*(s+a*x^c)(s+b*x^f); %Definition of the Function F(s)
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
f = ilaplace(F); %calculates the inverse Laplace transform of F(s), resulting in f(t).
f_func = matlabFunction(f) %converts the symbolic function f(t) into a regular MATLAB function.
% Define the time vector for plotting
t_vec = 0:0.1:10; % time from 0 to 10
% Plot the inverse Laplace transform
plot(t_vec, f_func(t_vec))
xlabel('Time (t)')
ylabel('f(t)')
title('Inverse Laplace Transform Plot')
grid on
I got this Error message: undefined function code for input argument of type 'cher'a=0.05;b=0.0045;c=0.067;f=0.0508;g=0.2;h=0.45;x=2.71828;j=232679478;r=0.742;k=(h+r);F =(1-g)*b*a*j*x^(c+f))/s*(s+a*x^c)(s+b*x^f) + (r*a*j*g*b*x^(c+f))/s*(s+k)*(s+a*x^c)(s+b*x^f); %Definition of the Function F(s)f = ilaplace(F); %calculates the inverse Laplace transform of F(s), resulting in f(t).f_func = matlabFunction(f) %converts the symbolic function f(t) into a regular MATLAB function.% Define the time vector for plottingt_vec = 0:0.1:10; % time from 0 to 10% Plot the inverse Laplace transformplot(t_vec, f_func(t_vec))xlabel('Time (t)')ylabel('f(t)')title('Inverse Laplace Transform Plot')grid onI got this Error message: undefined function code for input argument of type 'cher'

๋Œ“๊ธ€ ์ˆ˜: 7

Sam Chak
Sam Chak 2025๋…„ 3์›” 21์ผ

Hi Sunday,

Could you write out the transfer function F(s) on a piece of paper and take a photo? Later, we can check if it is correctly coded. Of course, you can also verify it yourself.

Star Strider
Star Strider 2025๋…„ 3์›” 21์ผ
You have an extra right parenthesis (that I deleted), and two missing operators (that I added as multiplication operators). The โ€˜fโ€™ expression is a function of the function and its first and second derivative. The function itself appears to be a constant, since its integral is an ascending straight line.
You most likely need to check to be certain that โ€˜fโ€™ is correct, then try again.
syms s t %defines s and t as symbolic variables.
a=0.05;
b=0.0045;
c=0.067;
f=0.0508;
g=0.2;
h=0.45;
x=2.71828;
j=232679478;
r=0.742;
k=(h+r);
F =(1-g)*b*a*j*x^(c+f)/s*(s+a*x^c)*(s+b*x^f) + (r*a*j*g*b*x^(c+f))/s*(s+k)*(s+a*x^c)*(s+b*x^f); %Definition of the Function F(s)
f = ilaplace(F); %calculates the inverse Laplace transform of F(s), resulting in f(t).
f = vpa(simplify(f, 500), 5)
fย =ย 
f_func = matlabFunction(f) %converts the symbolic function f(t) into a regular MATLAB function.
f_func = function_handle with value:
@(t)dirac(t).*3.35082543967152e+3+dirac(1,t).*5.804570831842721e+4+dirac(2,t).*8.74046132408455e+3+1.456430405094761e+1
% Define the time vector for plotting
t_vec = 0:0.1:10; % time from 0 to 10
% Plot the inverse Laplace transform
plot(t_vec, f_func(t_vec))
xlabel('Time (t)')
ylabel('f(t)')
title('Inverse Laplace Transform Plot')
grid on
figure
fplot(f, [0 10])
xlabel('Time (t)')
ylabel('f(t)')
title('Inverse Laplace Transform Plot')
grid on
figure
fplot(int(f), [0 10])
xlabel('Time (t)')
ylabel('\int{f(t)}')
title('Inverse Laplace Transform Plot')
grid on
.
Walter Roberson
Walter Roberson 2025๋…„ 3์›” 21์ผ
F =(1-g)*b*a*j*x^(c+f))/s*(s+a*x^c)(s+b*x^f) + (r*a*j*g*b*x^(c+f))/s*(s+k)*(s+a*x^c)(s+b*x^f); %Definition of the Function F(s)
1 0 1 0v 0 v0 v 0 1 0v 0 v 0 v0 v
The number below each ( ) is the number of open brackets "after" the effect of the symbol above it. Here, "v" has been used to represent -1 -- the case where there has been one too many ")"
F =(1-g)*b*a*j*x^(c+f))/s*(s+a*x^c)(s+b*x^f) + (r*a*j*g*b*x^(c+f))/s*(s+k)*(s+a*x^c)(s+b*x^f); %Definition of the Function F(s)
^^ ^^
In MATLAB, the only case in which you can have two adjacent () expressions, is the case where the first one is a table variable dot index. For example,
T.(EXPRESSION)(INDEX)
is valid where EXPRESSION is either a string constant or a character vector or a positive integer.
Other than that exception for table dot indexing, adjacent () expressions are forbidden.
There is absolutely no implied multiplication in MATLAB -- not anywhere . (Including for internal MuPAD symbolic expressions.) . All multiplication must be indicated explicitly, using either the .* operator or the * operator.
Sunday Aloke
Sunday Aloke 2025๋…„ 3์›” 21์ผ

@ Sam Chak

Sam Chak
Sam Chak 2025๋…„ 3์›” 21์ผ
Hi @Sunday Aloke, you can click this image button to upload the photo of the Transfer Function, .
Sunday Aloke
Sunday Aloke 2025๋…„ 3์›” 21์ผ

@Sam Chak The image is not downloading. No response whenever I click on it

Sam Chak
Sam Chak 2025๋…„ 3์›” 21์ผ
Perhaps you can find a free image hosting website that requires no registration and allows for simple drag-and-drop functionality, such as Imagebam, Imgbb, or Imgur. Then copy and paste the link in your comment.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

 ์ฑ„ํƒ๋œ ๋‹ต๋ณ€

David Goodmanson
David Goodmanson 2025๋…„ 3์›” 22์ผ
ํŽธ์ง‘: David Goodmanson 2025๋…„ 3์›” 22์ผ

0 ๊ฐœ ์ถ”์ฒœ

Hi SA
Speculative answer: I don't believe that the function F is a likely candidate for a Laplace transform. What you have is (looking at just the first term)
F = const/s*(s+a*x^c)*(s+b*x^f)
which is actually (by mistake?)
(const/s)*(s+a*x^c)*(s+b*x^f)
i.e. two factors involving s in the numerator. For the inverse transforn, that leads to stuff like the derivative of a delta function. What seems more likely is
const/(s*(s+a*x^c)*(s+b*x^f))
with all the s factors in the denominator. Similarly for the second term.
Both terms have a factor of s in the denominator. If
invLaplace(g(s)/s) = G(t)
then removing the s in the denominator effectively multplies by s and gives the time domain derivative,
invLaplace(g(s)) = dG(t)/dt.
The code below does both cases.
syms s t
a=0.05;
b=0.0045;
c=0.067;
f=0.0508;
g=0.2;
h=0.45;
x=2.71828;
j=232679478;
r=0.742;
k=(h+r);
d1 = (1-g)*b*a*j*x^(c+f)
d2 = r*a*j*g*b*x^(c+f)
F = d1/(s*(s+a*x^c)*(s+b*x^f)) + d2/(s*(s+k)*(s+a*x^c)*(s+b*x^f));
Fs = d1/( (s+a*x^c)*(s+b*x^f)) + d2/( (s+k)*(s+a*x^c)*(s+b*x^f));
f = ilaplace(F);
fs = ilaplace(Fs);
f_fun = matlabFunction(f);
fs_fun = matlabFunction(fs);
% Define the time vector for plotting
tvec = 0:2000; % extend the time
y = f_fun(tvec);
ys = fs_fun(tvec);
% Plot the inverse Laplace transform
figure(1)
plot(tvec,ys)
grid on
xlabel('Time (t)')
ylabel('df(t)/dt')
title('Inverse Laplace Transform Plot')
grid on
figure(2)
plot(tvec,y)
grid on
xlabel('Time (t)')
ylabel('f(t)')
title('Inverse Laplace Transform Plot')
grid on

์ถ”๊ฐ€ ๋‹ต๋ณ€ (0๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Calculus์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

์ œํ’ˆ

๋ฆด๋ฆฌ์Šค

R2020a

ํƒœ๊ทธ

์งˆ๋ฌธ:

2025๋…„ 3์›” 21์ผ

ํŽธ์ง‘:

2025๋…„ 3์›” 22์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by