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?
古いコメントを表示
I will be thankful to your reply..
1 件のコメント
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.
回答 (3 件)
Walter Roberson
2012 年 12 月 3 日
0 投票
plot(). And fsolve()
1 件のコメント
vb
2012 年 12 月 3 日
編集済み: Walter Roberson
2012 年 12 月 3 日
vb
2012 年 12 月 3 日
編集済み: Walter Roberson
2012 年 12 月 3 日
10 件のコメント
Muruganandham Subramanian
2012 年 12 月 3 日
did you try my above code?
vb
2012 年 12 月 3 日
Muruganandham Subramanian
2012 年 12 月 3 日
Andrei Bobrov
2012 年 12 月 3 日
編集済み: Andrei Bobrov
2012 年 12 月 3 日
x=linspace(0,2,1000).';
y1=cos(x);
y2=x.^2;
plot([y1 y2]);
Walter Roberson
2012 年 12 月 3 日
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
2012 年 12 月 4 日
編集済み: Walter Roberson
2012 年 12 月 4 日
Walter Roberson
2012 年 12 月 4 日
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
2012 年 12 月 4 日
Walter Roberson
2012 年 12 月 4 日
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
2012 年 12 月 4 日
NEERAJA
2024 年 1 月 13 日
0 投票
Plot y x sin over 0 2 x with appropriate labels
1 件のコメント
Walter Roberson
2024 年 1 月 13 日
It is not clear to me that this would solve the original problem ?
カテゴリ
ヘルプ センター および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!