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 个评论
回答(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
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!