Help :Difficult to solve linear equations in matlab??

y(1)=302.6:0.0055:332.3;
y(2)=305.9:0.0096:355.2;
New=(14.58E-4-5.89E-12.*(y(1).^4-8.08E+8)-11.86E-4.*(y(1)-302.8)+18.84E-4.*(y(2)-y(1))^1.27)/(y(2)+y(1)).^0.31+5.37E-12.*(y(2)^4-y(1).^(4));
Ending with the following error
Unable to perform assignment because the indices on the left side are not compatible with the size of the right
side.
Error in Untitled2 (line 2)
y(1)=302.6:0.005:332.3;
I suspect I know a bit of what's going wrong.. yet I'm at a loss for how to fix it.. Any help is much appreciated

Answers (1)

You can't do that-
y(1)=302.6:0.0055:332.3;
y(1) refering a y array with index postion 1, how can you save multiple values on single array location?
Same can be allowed if you define cell array y{1}
See example
#Allowed
>> s(2)=5
s =
0 5
#Not Allowed
>> s(2)=1:1:5
In an assignment A(:) = B, the number of elements in A and B must be the same
You can try with change the names of array variables as y1 and y2

This question is closed.

Asked:

on 18 Jul 2019

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!