How to plot these functions in 3D space

2 ビュー (過去 30 日間)
Shilp Dixit
Shilp Dixit 2013 年 1 月 30 日
Hi,
I want to plot the following variables U, s1, s2, x1 and x2 in a 3D plot. How do I go about this in MATLAB?
if true
if x1*(x1 - x2) >= 0
s1 = x1;
else
s1 = 0;
end
if -x2*(x1 - x2) >= 0
s2 = x2;
else
s2 =0;
end
U = G*(a*s1 + (1-a)*s2); % G and a are constants.
end
From what I understand this will require a sampling frequency. F = 100000 should suffice for my needs. I just want to know what the approach is for such problems.
Thanks.
Shilp
  2 件のコメント
Walter Roberson
Walter Roberson 2013 年 1 月 30 日
Are you looking for 3D line graphs? Surface graphs? Solid objects?
Which variables are to be on the two axis? x1 and x2, right?
How do you want to handle the fact that you have 3 output variables based on x1 and x2? That is, s1, s2, and U ?
You did not indicate what was to be sampled at F = 100000. You also did not indicate the range of the variables that are to be plotted at that frequency.
Have you noticed that if x1 >= 0 and x2 < 0, then both s1 and s2 will be non-zero? Whereas for positive x1 and x2, only one of them will be non-zero.
Shilp Dixit
Shilp Dixit 2013 年 1 月 30 日
Hi Walter,
I am looking for any graph that will help me understand(and visualize) how s1, s2 and U behave according to x1 and x2.
variables to be used on the axis - x1 and x2
I dont mind if we have three different graphs.
x1 and x2 to be sampled at F = 100000. x1 and x2 vary from -100 to +100.
The design of s1 and s2 is just as per my problem statement. so no issues there.
Please let me know if any further clarifications are needed.
Thanks.
Shilp

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

採用された回答

Matt J
Matt J 2013 年 1 月 30 日
編集済み: Matt J 2013 年 1 月 30 日
It's still not clear to me what you mean by F=1e5. You cannot plot a 1e5 x 1e5 array of data. It will be too huge. Below is my guess as to what you really want.
[x1,x2]=ndgrid(linspace(-100,100,1000));
s1=x1;
s1(x1*(x1 - x2) < 0)=0;
surf(x1,x2,s1);
and similarly for s2 and U...
  1 件のコメント
Shilp Dixit
Shilp Dixit 2013 年 1 月 30 日
thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by