I am trying to plot the value of the function P(x,y) along the line segment that connects (0,0) and (6,4)

조회 수: 1 (최근 30일)
P(x,y) = 100*exp(-.4*( (x-1)^2 + 0.7*(y-3)^2))+ 80*exp(-.2*(2*(x-5)^5+1.5*(y-1)^2)); so I am going to use the plot(x.y) function. how do I plot a function along a segment that goes from (0,0) to (6,4) ? I am kind of lost.
  댓글 수: 3
Kevin Junior
Kevin Junior 2013년 10월 8일
am supposed to plot along a segment that starts at (0,0) and ends at (6,4)
Roger Stafford
Roger Stafford 2013년 10월 9일
You had better pay attention to what Matt has told you. In the second term you will get exp(1251.5) at (0,0) which is an enormous number well above matlab's double precision floating point maximum value. Someone is pulling your leg or you have copied the problem incorrectly.

댓글을 달려면 로그인하십시오.

답변 (1개)

Honglei Chen
Honglei Chen 2013년 10월 8일
편집: Honglei Chen 2013년 10월 8일
I think you need to use plot3 for this. You need to first find x and y points you want. For example
x = 0:0.01:6;
y = 4/6*x;
z = x+y;
plot3(x,y,z);

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by