which one of these is the right sol.? and let me know my mistakes please ..
    2 views (last 30 days)
  
       Show older comments
    
    Rama a
 on 5 Jun 2021
  
    
    
    
    
    Answered: Sulaymon Eshkabilov
      
 on 15 Jun 2021
              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)
0 Comments
Accepted Answer
  Sulaymon Eshkabilov
      
 on 5 Jun 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 Comment
More Answers (1)
  Sulaymon Eshkabilov
      
 on 15 Jun 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*--')
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
