how to plot the drivative ?

1 view (last 30 days)
Tomer Segev
Tomer Segev on 8 Oct 2020
Edited: VBBV on 9 Oct 2020
s= [0,5*10^-2,1*10^-1,1.5*10^-1,2*10^-1,2.5*10^-1,3*10^-1,3.5*10^-1,4*10^-1,4.5*10^-1,5*10^-1,5.5*10^-1,6*10^-1,6.5*10^-1,7*10^-1,7.5*10^-1,8*10^-1,8.5*10^-1,9*10^-1,9.5*10^-1,9.9*10^-1,9.99*10^-1,1,1,1,1,1];
omega= [3.74*10^-1, 3.8*10^-1,3.87*10^-1,3.94*10^-1,4.02*10^-1,4.11*10^-1,4.2*10^-1,4.29*10^-1,4.4*10^-1,4.51*10^-1,4.64*10^-1,4.78*10^-1,4.94*10^-1,5.12*10^-1,5.33*10^-1,5.57*10^-1,5.86*10^-1,6.23*10^-1,6.72*10^-1,7.46*10^-1,8.71*10^-1,9.56*10^-1,9.68*10^-1,9.72*10^-1,9.75*10^-1,9.8*10^-1,9.86*10^-1];
Z1= 1+((1-(s.^2)).^(1/3)).*(((1+s).^(1/3))+(1-s).^(1/3));
Z2= sqrt(3*(s.^2)+(Z1.^2));
Ri= 3+Z2-sqrt((3-Z1).*(3+Z1+2.*Z2));R= 3+Z2+(sqrt((3-Z1).*(3+Z1+2.*Z2)));
Wi= (s+((Ri).^(3/2))).^-1;
WR= (s+((R).^(3/2))).^-1;
Rlr= 2*(1+cos((2/3)*acos(-s)));
Wlr= (s+((Rlr).^2)).^-1;
plot(s,Wi,'r');
hold on
plot(s,WR,'y'),plot(s,Wlr,'b'),plot(s,omega,'g');
hold off
xlabel('spin'),ylabel('angular velocity'),legend('r-prograde Isco angular velocity','y-retrograde ISCO angular velocity','b-LR angular velocity','g-given angular velocity');
y= diff(Wi);
s=diff(s);
c=diff(omega);
plot(s,y,'r');
how can I plot this ? because it doesn't give me to plot y over s
  3 Comments
Tomer Segev
Tomer Segev on 8 Oct 2020
but s is variable that goes to one, and here it goes just until 0.05
VBBV
VBBV on 9 Oct 2020
Edited: VBBV on 9 Oct 2020
you are using hold off in your program. So its plotting only the last figure. Use the legend function in the last line preferably to match the variables. You are taking the diff of the vector s . The max value in s is 0.05
s= [0,5*10^-2,1*10^-1,1.5*10^-1,2*10^-1,2.5*10^-1,3*10^-1,3.5*10^-1,4*10^-1,4.5*10^-1,5*10^-1,5.5*10^-1,6*10^-1,6.5*10^-1,7*10^-1,7.5*10^-1,8*10^-1,8.5*10^-1,9*10^-1,9.5*10^-1,9.9*10^-1,9.99*10^-1,1,1,1,1,1,1];
omega= [3.74*10^-1, 3.8*10^-1,3.87*10^-1,3.94*10^-1,4.02*10^-1,4.11*10^-1,4.2*10^-1,4.29*10^-1,4.4*10^-1,4.51*10^-1,4.64*10^-1,4.78*10^-1,4.94*10^-1,5.12*10^-1,5.33*10^-1,5.57*10^-1,5.86*10^-1,6.23*10^-1,6.72*10^-1,7.46*10^-1,8.71*10^-1,9.56*10^-1,9.68*10^-1,9.72*10^-1,9.75*10^-1,9.8*10^-1,9.86*10^-1,9.92*10^-1];
Z1= 1+((1-(s.^2)).^(1/3)).*(((1+s).^(1/3))+(1-s).^(1/3));
Z2= sqrt(3*(s.^2)+(Z1.^2));
Ri= 3+Z2-sqrt((3-Z1).*(3+Z1+2.*Z2));R= 3+Z2+(sqrt((3-Z1).*(3+Z1+2.*Z2)));
Wi= (s+((Ri).^(3/2))).^-1;
WR= (s+((R).^(3/2))).^-1;
Rlr= 2*(1+cos((2/3)*acos(-s)));
Wlr= (s+((Rlr).^2)).^-1;
plot(s,Wi,'r');
hold on
plot(s,WR,'y'),plot(s,Wlr,'b'),plot(s,omega,'g');
hold on
xlabel('spin'),ylabel('angular velocity'),legend('r-prograde Isco angular velocity','y-retrograde ISCO angular velocity','b-LR angular velocity','g-given angular velocity');
y= diff(Wi);
s=diff(s);
c=diff(omega);
plot(s,y,'r');

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!