Subscription assignment dimension mismatch.

1 vue (au cours des 30 derniers jours)
sriram amarnath
sriram amarnath le 29 Juil 2019
Lx=0.286; % length of plate(m)
Lz=0.198; % breadth of plate(m)
F=1;% Point load assumed to be 1 newton @ (x0,z0)
Y=1.4e9 ;%Youngs modulus
sigma=0.3;%Poissons ratio
eta=4e-2;%Damping Factor
D=Y*d^3/(12*(1-sigma^2));% flexural density D eq 86 Notes
d=3.25e-3;% thickness of plate(m)(also h)
rowS=265*d;%Mass per unit area( M surface density)
m=1:1000;% mode numbers width
nmax=10; % mode numbers length
t=1; % time
x0=0.16;%exc=(0.16,0.083), point of excitation(m)
z0=0.083;%exc=(0.16,0.083), point of excitation(m)
xr=linspace(0,Lx,10);% 10 x co-ordinate points on surface
zr=linspace(0,Lz,10); % 10 z co-ordinate points on surface
wnm=zeros(nmax,length(m));% initial values as place holders
for n=1:nmax
wnm(n,:)=sqrt(D/rowS)*((n*pi./Lx).^2 +(m*pi/Lz).^2); % eq 91 modes for m=1:1000 & n=1:10
end
wp=2*pi*500; % pressure plot @ 500 Hz
[X,Z]=meshgrid(xr,zr);% plane to be plotted on
y = zeros(10,10,1000,10) ;
for xpos= 1:length(X)
for zpos=1:length(Z)
for m=1:1000
for n = 1:nmax
y(:,:,:,n) = ((4/(Lx*Lz))*(F/rowS).*(sin(n.*pi*x0/Lx).*sin(m.*pi.*z0/Lz).*sin(n.*pi.*X(xpos)/Lx).*sin(m.*pi.*Z(zpos)/Lz)).*exp(1j*wp*t))./(-wp^2+wnm(n,:).^2.*(1+1j*eta));% eq 98 notes
end
end
end
end (Source of the subscription error! How do I correct it? Please help)
sumy = sum(y,3) ; % sum of all modes
ydt=real(sumy);%real part displacement due to all modes
figure('NumberTitle','off','Name','Displacment @ 500 Hz')
surf(X,Z,ydt,'EdgeColor','interp');% surface plot
view(-90,90)
xlabel('Length')
zlabel('Displacement')
ylabel('Width')
  2 commentaires
Image Analyst
Image Analyst le 29 Juil 2019
We can't see that error until you first let us avoid the first one we get because you have not defined "d".
Siriniharika Katukam
Siriniharika Katukam le 5 Août 2019
I hope you are not confused with element wise multiplication(.*) and multiplication(*) while assigning the value to y(:,:,:,n).

Connectez-vous pour commenter.

Réponses (2)

Neuropragmatist
Neuropragmatist le 5 Août 2019
Type this code in the matlab command line:
dbstop if error
Then run your code and it will stop on a specific line. That line will have some sort of assignment on it that is not possible like:
x(2) = [1 2 3 4 5]
You can look for this by testing the size of the array on the left of the sign and the size of the array on the right of the equals sign. Either the variable on the left is not large enough for what comes after the equals sign or the variable created on the right of the equals sign is too large for some reason (more likely).

Navya Seelam
Navya Seelam le 6 Août 2019
Hi,
In the line below, RHS has dimensions of 1*1000 and LHS has dimensions 10*10*1000. Make sure the dimensions match to avoid error.
y(:,:,:,n) = ((4/(Lx*Lz))*(F/rowS).*(sin(n.*pi*x0/Lx).*sin(m.*pi.*z0/Lz).*sin(n.*pi.*X(xpos)/Lx).*sin(m.*pi.*Z(zpos)/Lz)).*exp(1j*wp*t))./(-wp^2+wnm(n,:).^2.*(1+1j*eta));

Community Treasure Hunt

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

Start Hunting!

Translated by