which one of these is the right sol.? and let me know my mistakes please ..

7 vues (au cours des 30 derniers jours)
xb (t)= r(t ) - r(t-A ) - r(t-B ) + r(t-C )
A = 3, B = 4 and C = 4.
which one of these is the right sol.
and let me know my mistakes please
syms Xb t;
y1=t.*heaviside(t);
y2=(t-3).*heaviside(t-3);
y3=(t-4).*heaviside(t-4);
y4=(t-4).*heaviside(t-4);
Xb=y1-y2-y3+y4;
fplot(Xb);
xlabel('t');
ylabel('Xb(t)');
title (' xb(t)= r(t ) - r(t-3 ) - r(t-4 ) + r(t-4 ) ');
***************************************************************
syms t
A=3
B=4
C=4
t= 0: 0.02:5;
u=t>= 0;
u1=t>= 1;
X= t.*u-(t-A).*u1-(t-B).*u1+(t-C).*u1;
plot(t,X)

Réponse acceptée

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 5 Juin 2021
Both are accurate and you can get the same results by changing this in the 1st one:
fplot(Xb, [0, 5]);
In the second one, you should not make t symbolic.
Note that the second one is computationally more efficient.
  1 commentaire
Rama a
Rama a le 5 Juin 2021
Modifié(e) : Rama a le 5 Juin 2021
thanks
so the second code should be like this ?
A=3
B=4
C=4
t= 0: 0.02:5;
u=t>= 0;
u1=t>= 1;
X= t.*u-(t-A).*u1-(t-B).*u1+(t-C).*u1;
plot(X);
and I want you to run the two codes please .. there is a difference between between the plot of the first code and the second one from 1 to 3 on Y axis

Connectez-vous pour commenter.

Plus de réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 15 Juin 2021
Both gives the same results, if you fix in the second one the time boundary value for u1.
...
A=3;
B=4;
C=4;
t= 0: 0.02:5;
u=t>= 0;
u1=t>= 3; % Start at 3rd second
X= t.*u-(t-A).*u1-(t-B).*u1+(t-C).*u1;
plot(t,X, 'r*--')

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by