Creating a Matrix from a nesting For loop
显示 更早的评论
Hello
I am currently working on a school project and needing some assistance with syntax. New to Matlab by the way.
Basically, I am trying to set up a 3d graph that is like a multiplication table.
Id like to be set up in a way that when x=1 and y=1 then z=1. But then the x=1 is also multiplied by y=2, y=3,y=4 ... and so on (to 25). To be able to create a 3d graph however the Z-axis is supposed to be presented as a matrix. How can I create a matrix that lines up with this multiplication. Where the corners will equal 1, 25, 25, 625 respectively. And then be able to graph those values on a x,y,z
Here is what I have so far:
x=0;
y=0;
for Kx=1:25
x=1+x;
y=0;
for Ky=1:25
y=1+y;
end
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
