Info
This question is closed. Reopen it to edit or answer.
basic matlab help: mimes inner matrix dimensions must agree
1 view (last 30 days)
Show older comments
>> R=2.5:0.01:4; >> S=(1+R+(R.^2)/3)*exp(-R); ??? Error using ==> mtimes Inner matrix dimensions must agree.
>> J=exp(-2*R)*(1+R.^-1); ??? Error using ==> mtimes Inner matrix dimensions must agree.
need to plot these for R between 2.5-4
I really don't know how to fix this :(
0 Comments
Answers (1)
Star Strider
on 23 Feb 2014
Edited: Star Strider
on 23 Feb 2014
You were close to being successful. You need to use .* to do element-by-element multiplication:
R=2.5:0.01:4;
S=(1+R+(R.^2)/3).*exp(-R);
J=exp(-2*R).*(1+R.^-1);
That should do what you want. (It at least runs without errors.)
It might be a bit more efficient to write J as:
J = exp(-2*R).*(1+1./R);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!