Question: 1. Convert the following MatLab code of a graph to Maple code: clear z=[10,40,80] g=3; h=4; d=0.8; for b=1:3 n=z(b); a=[1:500];i=1; for x=0:0.01:5 s1=1./(n+h).^2; s2=(n.^2+n+((d.^2)./(1+x).^2)+((2.*d.*n)./(1+x))).*x.^2;
1. Convert the following MatLab code of a graph to Maple code:
clear z=[10,40,80] g=3; h=4; d=0.8; for b=1:3 n=z(b); a=[1:500];i=1; for x=0:0.01:5 s1=1./(n+h).^2; s2=(n.^2+n+((d.^2)./(1+x).^2)+((2.*d.*n)./(1+x))).*x.^2; s3=(4.*n+((4.*d)./(1+x))+2.*g.*n+((2.*d.*g)./(1+x))).*x; s4=g.^2+2.*g+2; s=s1.*(s2+s3+s4); a(i)=s+1 i=i+1; end x=0:0.01:5 if (b==1) c=plot(x,a,'b'); set(c,'Color','blue','LineWidth',2); elseif (b==2) c=plot(x,a,'g'); set(c,'Color','green','LineWidth',2); else c=plot(x,a,'m'); set(c,'Color','magenta','LineWidth',2); end hold on end x=[0:0.01:5]; y=(x.^2+1); a=plot(x,y,':k'); set(a,'Color','black','LineWidth',2); hleg1 = legend('For p=10','For p=40','For p=80','function','location','northwest'); set(hleg1,'Box','off') hold on xlabel('x ( for a=0.8, \lambda=3, \mu=4 )') hold on
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
