How to plot under certain conditions ?
古いコメントを表示
Hello guys, I want to plot every point (x element of [-4,4], y element of [-4,4]) that meets the following conditions:
- norm([x;y])<=4
The syntax is not right here, but I hope you understand what I'm looking for. For example the point x = 2, y = 2 would meet my requirements and therefore should be plotted.
I am aware of the fact that this is just another way of drawing a circle, but I want to dynamically change my norm (i.e. norm([x;y],1)). I am thankful for every bit of help I can get.
採用された回答
その他の回答 (1 件)
Jan
2017 年 11 月 25 日
Since Matlab R2016 with auto expanding:
x = -4:4;
x2 = x.^2;
D = x2 .* x2.' < 16;
Note: Comparing with 4^2 is cheaper than calculating the SQRT().
カテゴリ
ヘルプ センター および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!