Borrar filtros
Borrar filtros

2DOF question and other things...help me...

1 visualización (últimos 30 días)
alsgud qor
alsgud qor el 16 de Abr. de 2020
Comentada: Ameer Hamza el 19 de Abr. de 2020
  2 comentarios
Ameer Hamza
Ameer Hamza el 16 de Abr. de 2020
This is a homework question. Show us what you have already tried. Also read this: https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
alsgud qor
alsgud qor el 19 de Abr. de 2020
Editada: alsgud qor el 19 de Abr. de 2020
sorry this is what i ve done. I dunno how to put X, Y simultaneously...and there is error that
'HW5'function isn't defined like this...
======================================
function Homework5 =HW5(t,X)
m=10;
c=1000;
k=100000;
e=0.001;
w=100;
R=0.5;
X=R*cos(w*t);
Y=R*sin(w*t);
F1=m*e*w^2*cos(w*t);
F2=m*e*w^2*sin(w*t);
Homework5=[X(2); -c/m*X(2)-k/m*X(1)+F1/m];
==========================================
t=0:0.1:20;
>> X0=[0,0];
>> [t,X]=ode45(@HW5,t,X0);
and the error was 'Index exceeds array boundaries'

Iniciar sesión para comentar.

Respuestas (1)

Ameer Hamza
Ameer Hamza el 19 de Abr. de 2020
Since you haven't posted the equation in mathematical form, so I can only guess. The following code will not give any error, but I am not sure if it is what you want?
t=0:0.1:20;
X0=[0,0];
[t,X]=ode45(@HW5,t,X0);
function Homework5 =HW5(t, X)
m=10;
c=1000;
k=100000;
e=0.001;
w=100;
R=0.5;
F1=m*e*w^2*cos(w*t);
Homework5=[X(2); -c/m*X(2)-k/m*X(1)+F1/m];
end
  4 comentarios
alsgud qor
alsgud qor el 19 de Abr. de 2020
mx''+cx'+kx=mew^2coswt
my''+cy'+ky=mew^2sinwt
and this is my current progress...plz check this is right or not...
=============================
function Xdot =HW5(t,X)
m=10;
c=1000;
k=100000;
e=0.001;
w_rpm = 100; % 100, 1000, 2000
w=w_rpm*2*pi/60;
Fh=m*e*w^2*cos(w*t); % horizontal
Fv=m*e*w^2*sin(w*t); % vertical
% m x'' + c x' + k x = Fh (horizontal)
% x'' = -c/m x' -k/m x + Fh/m
% x1' = x2
% x2' = -c/m x2 -k/m x1 + Fh/m
% m y'' + c y' + k y = Fv (vertical)
% y'' = -c/m y' -k/m y + Fh/m
% y1' = y2
% y2' = -c/m y2 -k/m y1 + Fh/m
% X = [x1 ; x2 ; y1 ; y2]
Xdot=[X(2);
-c/m*X(2)-k/m*X(1)+Fh/m;
X(4);
-c/m*X(4)-k/m*X(3)+Fv/m];
end
======================
figure, plot(X(:,1)*1e3,X(:,3)*1e3)
grid on
xlabel('x, mm')
ylabel('y, mm')
pbaspect([1 1 1])
legend('2000 rpm')
Ameer Hamza
Ameer Hamza el 19 de Abr. de 2020
Considering the ODEs you wrote, the function appears to be correct. However, the ODEs seems to be independent of each other? One would expect that for such a system, the system of ODEs should be coupled.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by