# Variable name matlab help

by mathsgeek
Tags: matlab, urgent, variable
 P: 122 Variable name matlab help JeroenS' code has a mistake inside for loop. v_max(1,n-4) ==> indicate member (1, n-4) of array v_max. However, in the calculation, he forgot to delete the operator for array: (radius.*n). This operator (.*) will return an array radius multipled by n. So, in the left-side, you have 1 variable, not an array but in right side, there is an array. That's the reason matlab throws an error. My code is: vM = []; j = 0; radius = 1 : 0.5 : 2.5; tfv = 5; for n = 5 : 1 : 10 j = j + 1; nR = 2 * pi * (radius * n).^2; vM(j, :) = (1 + n) * (1 + 2*n) * tfv ./ nR; end Hope this help. p/s: i am totally confused when i read your code. There are many unnecessary parentheses and operators.