Matrix Dimensions Must Agree
Afficher commentaires plus anciens
I have written the code shown below but I'm getting problems with matrix dimension errors, even though all my matrices are the same size, I have also tried using the transpose of Wn to get around the problem but nothing seems to fix it, could anyone spot where the error is?
clc
clear all
rho = 7800; %kg/m^3
b = 67*10^-3;
h = 67*10^-3;
A = b*h; %m^2
E = 200*10^9; %Pa
I = (b*h^3)/12;
L = 1; %m
F0 = 100; %N
Omega = 10; %Hz
x = 0.5; %m - Distance to midspan from the end of the beam
t = linspace(0,20,5); n = [1,3,5,7,9];
Wn = zeros(length(n),1);
for i = 1:length(n)
Wn(i) = (n(i).^2.*pi.^2./L.^2).*sqrt(E*I/rho*A);
v(i) = (((-1).^(n(i)-1)/2)/(Wn.^2-Omega^2))*sin(n(i)*pi*x/L)*(sin(Omega*t)-(Omega/transpose(Wn))*sin(Wn.*t))
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!