How can I plot a surface with changing constant?
古いコメントを表示
Hi guys,
I have a complex question. I want to graph the following equation as a surface. However, the constant A changes with a certain value of the y-axis:
Want to graph: z = M - 10x - 3.5y
Where
M = 5 + 3 for y < 10
M = 5 + 4 for 10 < y < 20
M = 5 + 5 for 20 < y < 30
Does this make sense? The value of the constant depends on the value of the y.
How can I approach this?
Thanks
採用された回答
その他の回答 (1 件)
Walter Roberson
2014 年 4 月 17 日
[X, Y] = ndgrid(....);
Z = 5 - 10 * X - 3.5 * Y;
Z(10 < Y & Y < 20) = Z(10 < Y & Y < 20) + 4;
and so on.
Note: your M is not defined for Y = 10 exactly or Y = 20 exactly
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!