How to solve matrix exponent equation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I will be thankful if someone helps me. Here is my task:
Reduce to a system and solve a matrix exponent equation under zero initial conditions.
y'' + 16y = sin4x
I wrote it in MatLab but im not sure if it is correct and also im not sure about z below. I dont know how we decide the value of z. The current zvalue of z is from another task.
clear all;
A=[0 1;-16 0];
y=[0;0]; h=0.1; n=100; x1=0;
y1(1)=0; y2(1)=0; x(1)=0;
B=[0;1];
A2=expm(A*h)
for i=2:n
y=A2*y+(h/2)*(A2*B*sin(4*x1) + B*cos((4*x1)+h));
y1(i)=y(1); y2(i)=y(2);
x1=x1+h;
x(i)=x1;
end
plot (x, y1, 'r', x,y2,'c'), figure(gcf), pause
z=exp(-x).*(-0.4*cos(2*t)-0.3*sin(2*t)) + 0.4*cos(t)+0.2*sin(t);
plot(x,z,'r',x,y1,'c'), figure(gcf)
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Assembly 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!