Plotting 3D with two functions

1 回表示 (過去 30 日間)
Luis Francisco Sanchez
Luis Francisco Sanchez 2019 年 10 月 31 日
コメント済み: Walter Roberson 2019 年 10 月 31 日
I have two functions (a,b,c,...,f are constants):
y(x) = ax^5 +bx^4 +cx^3 +dx^2 +ex + f
z(x) = a2x^5 +b2x^4 +c2x^3 +d2x^2 +e2x + f2
For the above I have a X-Y plot and a X-Z plot(the X axis is the same for both). I want to know how can I create a 3d plot that shows both coordinate systems. I would really aprecciate if anyone can code a solution
  3 件のコメント
Luis Francisco Sanchez
Luis Francisco Sanchez 2019 年 10 月 31 日
Thank you very much. I have another doubt... If I have a compound function for y and z (it changes between specific intervals), how can I define the parameters for the different intervals in the plot?
Walter Roberson
Walter Roberson 2019 年 10 月 31 日
If you use the Symbolic Toolbox you can use piecewise()
If you are working numerically, then there is a trick that can often (but not always) be used:
result = (condition1) .* (expression_that_applies_when_condition1_is_true) + (condition2) .* (expression_that_applies_when_condition2_is_true);
for example,
y = (x>=0 & x<=5) .* (x.^2-5*x+3) + (x>5 & x<10) .* (3+sin(8*pi*x))

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by