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!