How can I write a program and plot a 3-D graph?
Mostra commenti meno recenti
There are 60 points in a plane. (15 points in the X-axis and 4 points in the Y-axis,respectively). The plane is divided into elements with various size. In the first element there are 20 points (X - from 1 to 5 and Y - form 1 to 4), the second - 16 points (X - from 6 to 9 and Y - form 1 to 4), the third (X - from 10 to 12 and Y - form 1 to 4), the fourth (X - from 13 to 14 and Y - form 1 to 4), the last ( X - 15 , Y from 1 to 4). I need to sum up all the points in each element and show the result in 3-D graph.
%To sum all the points in the first element
for i=1:5
for j=1:4
x(i)=i;
y(j)=j;
z(i,j)=x(i)+y(j);
end
end
%To sum all the points in the second element
for i=6:9
for j=1:4
x(i)=i;
y(j)=j;
z(i,j)=x(i)+y(j);
end
end
Finally, I need to show the results one element after another in 3-D plot. So, I have to write many for loops and I don't want it. Kindly help with your suggestions please. Sorry for my poor English.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Mathematics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!