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?
Ältere Kommentare anzeigen
I will be thankful to your reply..
1 Kommentar
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.
Antworten (3)
Walter Roberson
am 3 Dez. 2012
0 Stimmen
plot(). And fsolve()
1 Kommentar
vb
am 3 Dez. 2012
Bearbeitet: Walter Roberson
am 3 Dez. 2012
vb
am 3 Dez. 2012
Bearbeitet: Walter Roberson
am 3 Dez. 2012
10 Kommentare
Muruganandham Subramanian
am 3 Dez. 2012
did you try my above code?
vb
am 3 Dez. 2012
Muruganandham Subramanian
am 3 Dez. 2012
Andrei Bobrov
am 3 Dez. 2012
Bearbeitet: Andrei Bobrov
am 3 Dez. 2012
x=linspace(0,2,1000).';
y1=cos(x);
y2=x.^2;
plot([y1 y2]);
Walter Roberson
am 3 Dez. 2012
MATLAB is not going to tell you what the point of intersection is. You can zoom in near the point of intersection and use the datacursor to find nearby points. Or, without going to that trouble to find a guess, you can use fsolve() to determine where the point of intersection is.
vb
am 4 Dez. 2012
Bearbeitet: Walter Roberson
am 4 Dez. 2012
Walter Roberson
am 4 Dez. 2012
If you want to mark or label the point of intersection on the graph, you will have to record the output of fsolve(), calculate the y corresponding to that x, and then create the form of mark that you want such as by using text() or annotate()
vb
am 4 Dez. 2012
Walter Roberson
am 4 Dez. 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')
vb
am 4 Dez. 2012
NEERAJA
am 13 Jan. 2024
0 Stimmen
Plot y x sin over 0 2 x with appropriate labels
1 Kommentar
Walter Roberson
am 13 Jan. 2024
It is not clear to me that this would solve the original problem ?
Kategorien
Mehr zu Annotations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!