In an assignment A(I) = B, the number of elements in B and I must be the same.

My code is given below.Anyone of you can correct it?
clear all clc r(10)=1; x(10)=[0.1 0.2]'; Phi_Phi =[1.1541 1.0407 0.9116 0.7726 1.0407 0.9549 0.8475 0.7259 0.9116 0.8475 0.7675 0.6674 0.7726 0.7259 0.6674 0.5943]; Phi =[0.1000 0 0 0 0.1800 0.1000 0 0 0.2440 0.1800 0.1000 0 0.2952 0.2440 0.1800 0.1000 0.3362 0.2952 0.2440 0.1800 0.3689 0.3362 0.2952 0.2440 0.3951 0.3689 0.3362 0.2952 0.4161 0.3951 0.3689 0.3362 0.4329 0.4161 0.3951 0.3689 0.4463 0.4329 0.4161 0.3951]; F =[0.8000 1.0000 1.4400 1.0000 1.9520 1.0000 2.3616 1.0000 2.6893 1.0000 2.9514 1.0000 3.1611 1.0000 3.3289 1.0000 3.4631 1.0000 3.5705 1.0000];
for k=10:20 BarRs=[1 1 1 1 1 1 1 1 1 1]'; Rs=BarRs*r(k); f=inv(Phi_Phi+10*eye(4)) g=(Phi'*Rs)-(Phi'*F*x(k)) deltau=f*g end

1 Comment

Yes. By highlighting the code and applying the formatting button
it will display much more neatly.

Answers (1)

Manoj
Manoj on 25 Aug 2014
Edited: Manoj on 25 Aug 2014
In x(10), you have assigned two values which is not possible. It can accept only one value. You are trying to assign two values to one position.
Hope this helps

This question is closed.

Asked:

on 25 Aug 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!