Hello there,
I would like to plot a function of two variables along a line.
For instance, let us consider the function in . I would like to plot its restriction along the line .
Which is the best way to visualize it?
Thanks a lot.

 採用された回答

Walter Roberson
Walter Roberson 2021 年 10 月 9 日
編集済み: Walter Roberson 2021 年 10 月 9 日

0 投票

syms x y(x)
y(x) = x
y(x) = 
x
f = x^2 + y(x)^2
f = 
fsurf(x, y(x), f, [0 1])

3 件のコメント

avati91
avati91 2021 年 10 月 9 日
Thanks a lot for the quick answer. I have another question connected to that. If now I have a collection of points in such that they represent a line a for such I have a value representing the value of a function. How could I plot the function in this case?
Walter Roberson
Walter Roberson 2021 年 10 月 9 日
%example data
n = 20;
x = sort(rand(1,n));
y = sort(rand(1,n));
z = x.^2 + y.^2 - atan2(y,x);
%do the plotting
plot3(x, y, z)
xlabel('x'); ylabel('y'); zlabel('z')
avati91
avati91 2021 年 10 月 9 日
Thank you very much for the extremely quick answer!

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021b

タグ

質問済み:

2021 年 10 月 9 日

コメント済み:

2021 年 10 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by