problem with plotting a 3D graph
Afficher commentaires plus anciens
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 commentaire
Azzi Abdelmalek
le 9 Août 2012
why
BL = Blue(1:end);
you can writte
BL = Blue
Réponse acceptée
Plus de réponses (2)
Azzi Abdelmalek
le 9 Août 2012
Modifié(e) : Azzi Abdelmalek
le 9 Août 2012
%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)
1 commentaire
James
le 9 Août 2012
Kartik Verma
le 1 Déc 2020
0 votes
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.
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!