when i run the code iam getting the error "Subscripted assignment dimension mismatch", can any one help me in fixxing the error and point where i should make necessary correction and mistakes

tc=0.087;tmax=5;delT=0.001;t0=1;delw(1)=0;delA(1)=d0;
arr1=linspace(t0,t0+tc,100);n1=length(arr1);
K1=[];K2=[];K3=[];K3=[];K4=[];L1=[];L2=[];L3=[];L4=[];
for i=1:n1-1
K1(i)=delw(i)*delT;
L1(i)=(1/(2*H))*(Pm-Pe2*sind(delA(i)))*delT;
K2(i)=(delw(i)+(L1(i)/2))*delT;
L2(i)=(1/(2*H))*(Pm-Pe2*sind(delA(i)+K1(i)/2))*delT;
K3(i)=(delw(i)+L2(i)/2)*delT;
L3(i)=(1/(2*H))*(Pm-Pe2*sind(delA(i)+K2(i)/2))*delT;
K4(i)=(delw(i)+L3(i))*delT;
L4(i)=(1/(2*H))*(Pm-Pe2*sind(delA(i)+K3(i)))*delT;
delA(i+1)=delA(i)+(K1(i)+2*K2(i)+2*K3(i)+K4(i))/6;
delw(i+1)=delw(i)+(L1(i)+2*L2(i)+2*L3(i)+L4(i))/6
end

1 Comment

Several of your various are not defined here. When I assign random scalars to them, I do not get any error message.
I notice you define arr1 but you do not use it.

Answers (0)

This question is closed.

Products

Tags

No tags entered yet.

Asked:

on 19 Apr 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!