In an assignment A(I) = B, the number of elements in B and I must be the same.
Show older comments
My for Loop performs three iteration and then I get this error "In an assignment A(I) = B, the number of elements in B and I must be the same"
rho = 1.21; c = 343; c2 = c^2; V = 1+0*1i; Qb = 1/(sqrt(2));
Vas = 0.008778;
Sd = 0.0062;
Sd2 = Sd^2;
Qm = 1.4; Qe = 0.47; Qt = 0.35; Ro = 7.4;
fs = 70;
S = (rho*c2*Sd2)/(Vas);
m = (S)/(4*pi^2*fs^2);
Bl = sqrt((Ro*S)/(Qe*2*pi*fs));
Rm = S/(Qm*2*pi*fs);
Vc = Vas*((1)/(((1/(sqrt(2)*Qt))^2)-1));
Sc = (rho*c2*Sd2)/(Vc);
f3 = (sqrt((S+Sc)/m))*(1/(2*pi));
N = 500; ws =1; we = N*2*pi;
r = 1;
for w = ws:1:we
%%Pressure Amplitude
Parray(w)= (rho/(4*pi*r))*((Sd*Bl)/(Ro*m))*(((1i*w).^2)/(((1i*w.^2)+(((2*pi*f3)/Qb)*(1i*w))+(2*pi*f3).^2)))*(abs(V));
P(w)= abs(Parray(w))
%%Velocity Amplitude
Varray(w) = (Bl/Ro)/((w*m*1i)+(Rm)+((Bl^2)/Ro)+(S/(1i*w))+((rho*c2*Sd2)/(Vc*1i*w)))*(V);
V(w) = abs(Varray(w))
%%Displacement Amplitude
Xarray(w) = (Varray(w))/(1i*w);
X(w) = abs(Xarray(w))
end
semilogx(P)
Not sure what size to worry abot. Thanks in advance
2 Comments
Walter Roberson
on 15 Aug 2013
Which line does the error occur on ?
John Ikon
on 15 Aug 2013
Accepted Answer
More Answers (1)
NED nabeel
on 10 Oct 2013
0 votes
I am getting this error, can some body help me what is wrong with it?
??? In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> MasterModel at 4 xCal(2) = (1/mm) *(Tm+fm-bm*x(2));
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!