The Student Room Group

Is there anyone that could help me with Matlab?

Are there any Matlab experts out there that could help me with Matlab please?
Reply 1
Original post by Zenarthra
Are there any Matlab experts out there that could help me with Matlab please?


Do you have a specific query?
Reply 2
Original post by Zacken
Do you have a specific query?



A = zeros(5,100);
for m = 1:5
for n = 1:100
A(m, n) = 1/(m + n - 1);
end
end

For this code, what is the purpose for defining the vector A 5 by 100 matrix.
When m reaches 5, does the first loop stop?
So do we continue to enter m=5 in the calculation while increasing with n up until 100?
What does A(m,n) mean? why not B = 1/(m+n-1)

Thanks
Reply 3
Original post by Zenarthra
A = zeros(5,100);
for m = 1:5
for n = 1:100
A(m, n) = 1/(m + n - 1);
end
end

For this code, what is the purpose for defining the vector A 5 by 100 matrix.
When m reaches 5, does the first loop stop?
So do we continue to enter m=5 in the calculation while increasing with n up until 100?
What does A(m,n) mean? why not B = 1/(m+n-1)

Thanks


Playing around with this might be of some help.

When m=5 then we keep m=5 constant and continue the loop for n. So what you said was correct, yes.

A(m,n) means that A depends on m and n - you can't do B = something because you haven't defined B before.

Quick Reply

Latest