problem with plotting a 3D graph
显示 更早的评论
Hi,
Please I need help to get the following code working:
Blue = [2 3 4 5 6]';
Green = [2 4 6 10 12]';
Red = [3 6 9 12 15]';
BL = Blue(1:end);
GR = Green(1:end);
RD = Red(1:end);
join = [];
for i = 1:GR
for j = 1:RD
join(i+1,j+1) = BL;
end;
end;
surf(join)
When I ran the code in Matlab, I got the following error message: "??? Subscripted assignment dimension mismatch." My intention was to plot the data in 3D.
Thanks
James
1 个评论
Azzi Abdelmalek
2012-8-9
why
BL = Blue(1:end);
you can writte
BL = Blue
采纳的回答
更多回答(2 个)
Azzi Abdelmalek
2012-8-9
编辑:Azzi Abdelmalek
2012-8-9
%if you want plot a 3D graph with x axis Blue and Yaxis Green and corresponding data : example : z=rand(5,5)
Blue = [2 3 4 5 6]';
Green = [2 4 6 10 12]';
z=rand(5,5)
surf(Blue,Green,z)
Kartik Verma
2020-12-1
0 个投票
Take two vectors, x and y, of your choice of length 50. Consider a function
z=x^2+y^2-xy
Make a 3D surface plot for x,y and z with proper axis titles, legends etc.
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!