How do i get past the dimension mismatch on line 36?
Afficher commentaires plus anciens
L = 0.64; % length of string (m)
T = 122; % tensile force of the string (N)
S=pi/(4e-6); % section of the string
rho = 7.8e6; % mass per unit length of string (kg/m)
c = sqrt(T/rho*S); % wave velocity (m/s)
%t = 1.3; % current time value (s)
xo = L/2; % initial displacement value (m)
% range variables
x = linspace(0,L,1000); % position points on string (m)
n = 1:numel(x); % integers for Fourier series
% pic=length(n)
% poc=length(x)
t = linspace(0,1.3,1000); %current time value (s)
%n = linspace(1,length(x),length(x)); % integers for Fourier series
v = zeros(length(n),length(x)); %tranverse displacement
pac=length(v)
h=4; % height of the string when plucked
part=((2.*(h.*L.^2))./((pi).^2.*n.^2*xo*(L-xo)));% Furier coefficient split
b= part.*sin((n.*pi*xo)./L); % the other half of Fourier coeeficient
w = n.*(pi./L); %angular velocity
for i = 1:length(x)
for j = 1:length(n)
for k=0:length(t)
% v(i,j) = v(i,j)+ % sin(n(j)*pi.*x(i)./L).*cos(c.*n(j).*pi*t./L).*b(j)
half = b(j).*(sin(w(j).*x(i)).*cos(w(j).*c.*t)) %equation split
v(i,j) = v(i,j)+ half;
end
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Descriptive Statistics and Visualization 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!