To draw a curve line

9 ビュー (過去 30 日間)
Cruise
Cruise 2011 年 9 月 7 日
Hi everybody.I want to draw a curve line and I used code
line([0 0],[0 952],[1238 1446]);
line([0 0],[952 1844],[1446 2000]);
line([0 0],[0 -952],[1238 1446]);
line([0 0],[-952 -1844],[1446 2000]);
But when Matlab run this code,I don't see what i need see. I think i should use "spline" but i can't. What need i do? thank so much/

採用された回答

Kelly Kearney
Kelly Kearney 2011 年 9 月 7 日
Are you looking for a simple interpolation?
Your data...
x = [0 0 0 0 0];
y = [-1844 -952 0 952 1844];
z = [2000 1446 1238 1446 2000];
Interpolate...
n = 50;
x1 = zeros(1,n);
y1 = linspace(min(y),max(y),n);
z1 = interp1(y,z,y1,'spline');
z2 = interp1(y,z,y1,'pchip');
Plot...
plot3(x,y,z,'b',x1,y1,z1,'r',x1,y1,z2,'g');
view(90,0);

その他の回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2011 年 9 月 7 日
Would the function rectangle() help?

Grzegorz Knor
Grzegorz Knor 2011 年 9 月 7 日
Maybe just:
view(3)
What exactly do you want to achieve? Smooth line? Or something different?
  1 件のコメント
Cruise
Cruise 2011 年 9 月 8 日
Smooth line .thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by