MATLAB: Subscript indices must either be real positive integers or logicals.

errorMATLABsubscript

here is what i have for code
u=8;
v=7;
w=1;
x=2;
y=9;
z=8;
n=(u/12) + 0.1;
U=1 + ((w + 1)/((3*x) + 1));
R=2.58283;
\ %------------------------------------------------------------------------%




%Values of
%------------------------------------------------------------------------%
\ r=linspace(0,R);
%------------------------------------------------------------------------%
\
%Values of Vprof
%------------------------------------------------------------------------%
\ m=1+(1/n);
Vprof=(((3*n)+1)/(n+1))*(U(((R).^2.3043)-(r).^2.3043)/R.^2.3043)
\ %------------------------------------------------------------------------%
\ end
I just have no idea how to proceed as i keep getting the error

Best Answer

prof=(((3*n)+1)/(n+1))*(U(((R).^2.3043)-(r).^2.3043)/R.^2.3043)
In this line, you try to reach a element of U by indexing but U is a scalar numeric value and you can only reach U(1). Check this part.