how to plot the graph for the functions 0<x<2 with y=sin x and y=x^3 and how to get point of intersection?

13 visualizzazioni (ultimi 30 giorni)
I will be thankful to your reply..
  1 Commento
Matt J
Matt J il 2 Dic 2012
Modificato: Matt J il 3 Dic 2012
Replies are unlikely if you show no evidence of having attempted the homework or of having read the MATLAB documentation. If you've done minimal reading of the Getting Started material, you should be aware of the PLOT command and seen examples of its use.

Accedi per commentare.

Risposte (3)

Walter Roberson
Walter Roberson il 3 Dic 2012
plot(). And fsolve()
  1 Commento
vb
vb il 3 Dic 2012
Modificato: Walter Roberson il 3 Dic 2012
x=linspace(0,2)
y1=cos(x)
y2=x.^2
plot(x,y1)
plot(x,y2)
grid on
i tried these but getting only one line so how will i get intersection point

Accedi per commentare.


vb
vb il 3 Dic 2012
Modificato: Walter Roberson il 3 Dic 2012
x=linspace(0,2,1000);
y1=cos(x);
y2=x.^2;
plot(x,y1);
plot(x,y2);
grid on
I tried this but i need point of intersection of two curves so when i do this in matlab i get only one curve
  10 Commenti
Walter Roberson
Walter Roberson il 4 Dic 2012
x_of_intersection = fsolve(@(x)cos(x)-x.^2,1);
y_of_intersection = cos(x_of_intersection);
text(x_of_intersection, y_of_intersection, 'LOOK HERE')

Accedi per commentare.


NEERAJA
NEERAJA il 13 Gen 2024
Plot y x  sin over 0 2  x  with appropriate labels

Community Treasure Hunt

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

Start Hunting!

Translated by