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

2 ビュー (過去 30 日間)
Kevin Junior 2013 年 10 月 8 日
コメント済み: Roger Stafford 2013 年 10 月 9 日
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 件のコメント

Matt J 2013 年 10 月 8 日
Are you sure that is the range you want. Note that
>> P(0,0)
ans =
Inf
Kevin Junior 2013 年 10 月 8 日
am supposed to plot along a segment that starts at (0,0) and ends at (6,4)
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.

サインイン to comment.

### 回答 (1 件)

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);

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by