why my script doesnt run ?

3 views (last 30 days)
Lefteris
Lefteris on 25 Nov 2022
Answered: Star Strider on 25 Nov 2022
clc;
close all;
syms s t ;
%Space of Time
t = 0:10:15000;
%Kelvie Temperature
t_initial = 423;
%2st case
u_t2 = 50000*heaviside(t)-15000*heaviside(t-2500)+10000*heaviside(t-5000)+8000*heaviside(t-8000);
d_t2 = 288;
%Laplace tranform
U_s2 = laplace(u_t2, s);
D_s2 = laplace(d_t2, s);
%Tranfer Function
Y_s2 = ((0.004)/(1000*s +1))*U_s2 + (1/(500*s + 1))*D_s2 + (1000/(1000*s + 1))*t_initial;
%Inverse Laplace Transform
y_t2 = ilaplace(Y_s2);
y_t2 = subs(y_t2, t);
y_t2 = double(y_t2);
figure(2)
plot(t, y_t2);
xlabel('Time (sec)')
ylabel('y(t)')
title('2nd Case')
grid on;

Answers (1)

Star Strider
Star Strider on 25 Nov 2022
Use fplot not plot here —
syms s t ;
%Space of Time
% % t = 0:10:15000; % Commented-Out
%Kelvie Temperature
t_initial = 423;
%2st case
u_t2 = 50000*heaviside(t)-15000*heaviside(t-2500)+10000*heaviside(t-5000)+8000*heaviside(t-8000);
d_t2 = 288;
%Laplace tranform
U_s2 = laplace(u_t2, s);
D_s2 = laplace(d_t2, s);
%Tranfer Function
Y_s2 = ((0.004)/(1000*s +1))*U_s2 + (1/(500*s + 1))*D_s2 + (1000/(1000*s + 1))*t_initial;
%Inverse Laplace Transform
y_t2 = ilaplace(Y_s2);
y_t2 = subs(y_t2, t);
% y_t2 = double(y_t2); % Not Possible With Retained Symbolic Variables
figure(2)
fplot(y_t2, [0 1.5E4]);
xlabel('Time (sec)')
ylabel('y(t)')
title('2nd Case')
grid on;
.

Community Treasure Hunt

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

Start Hunting!

Translated by