フィルターのクリア

Matlab how to make a 3d plot of the following data

1 回表示 (過去 30 日間)
RAN
RAN 2021 年 3 月 29 日
コメント済み: RAN 2021 年 4 月 6 日
Hello all,
A seemingly simple question but I just cant find an answer to it.
array_counter_a=1;
for a=0:1:30
array_counter_b=1;
for b=0:1:30
solution(array_counter_a,array_counter_b)= some_function(a,b)
array_counter_b = array_counter_b+1;
end
array_counter_a=array_counter_a+1;
end
a=0:1:30;
b=0:1:30;
So 'a' is a variable of size 30x1, 'b' is a variable of size 30x1, and the size of solution is the size of 30x30. Now i want to 3d plot of solution vs 'a' and 'b'. I always get an error saying dimensions mismatch, but i dont understand why.

採用された回答

VBBV
VBBV 2021 年 3 月 29 日
%if true
mesh(0:30,0:30,solution)
Try the above. If you have used
%if true
mesh(a,b,solution);
It won't work. Since a and b are for loop counters. So at end of loop their values are just 30 and 30.
  4 件のコメント
VBBV
VBBV 2021 年 3 月 30 日
Ok. Can you show the o/p?
RAN
RAN 2021 年 4 月 6 日
It works with mesh, instead of plot3. However it works, and I got what i needed. Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by