The solution yt consists of two exponential terms defined by
Solution
a)plot the matlab values by t and Y
code:
clc;
 clear all;
 t=0:0.01:10;
 A=8;
 B=-9;
 m1=3;
 m2=4;
 Y=(A*exp(-m1*t))-(B*exp(-m2*t))
 figure
 plot(t,Y,\':b\');
 xlabel(\'Time\');
 ylabel(\'Y(t)\');
b)
i)changing A coefficients as a random number
code:
clc;
 clear all;
 A=[-8 0.62 6 -20];
 B=-6;
 m1=-2;
 m2=-3;
 t=0:0.01:10;
 Y1=(A(1)*exp(-m1*t))-(B*exp(-m2*t));
 Y2=(A(2)*exp(-m1*t))-(B*exp(-m2*t));
 Y3=(A(3)*exp(-m1*t))-(B*exp(-m2*t));
 Y4=(A(4)*exp(-m1*t))-(B*exp(-m2*t));
 plot(t,Y1,t,Y2,t,Y3,t,Y4);
 legend(\'A=-8\',\'A=0.62\',\'A=6\',\'A=-20\');
ii)changing B coefficient values as a random number
code:
clc;
 clear all;
 B=[-5 0.66 6 -20];
 A=8;
 m1=-3;
 m2=-4;
 t=0:0.01:10;
 Y1=(A*exp(-m1*t))-(B(1)*exp(-m2*t));
 Y2=(A*exp(-m1*t))-(B(2)*exp(-m2*t));
 Y3=(A*exp(-m1*t))-(B(3)*exp(-m2*t));
 Y4=(A*exp(-m1*t))-(B(4)*exp(-m2*t));
 plot(t,Y1,t,Y2,t,Y3,t,Y4);
 legend(\'B=-5\',\'B=0.66\',\'B=6\',\'B=-20\');

