%% Ejercicio 5: Forzado, gráficos de A,B, modulo, fase vs frecuencia del forzado m=1; F0=1; gamma=1; w0=10; w=linspace(0,2*w0,1000); A=F0/m*w*gamma./((w*gamma).^2+(w0^2-w.^2).^2); B=F0/m*(w0^2-w.^2)./((w*gamma).^2+(w0^2-w.^2).^2); MODULO=sqrt(A.^2+B.^2); FASE=atan2(A,B); figure(1);clf subplot(2,2,1);hold all plot(w,A) plot(w,B) line(w0*[1 1],ylim) line(xlim,[0 0]) ylabel('Componentes') xlabel('Frecuencia excitación') legend('A en cuadratura','B en fase') subplot(2,2,2) plot(w,MODULO) line(w0*[1 1],ylim) ylabel('amplitud') xlabel('Frecuencia excitación') subplot(2,2,3) plot(w,FASE) line(w0*[1 1],ylim) ylabel('fase con respecto a la excitación') xlabel('Frecuencia excitación') ylim([0,pi]) line(w0*[1 1],ylim) line(xlim,pi/2*[1 1]) subplot(2,2,4);hold all FASE0=1; plot(w,MODULO.*sin(FASE+FASE0)) plot(w,MODULO.*cos(FASE+FASE0)) line(w0*[1 1],ylim) line(xlim,[0 0]) ylabel('Componentes') xlabel('Frecuencia excitación') legend('Una componente','Otra componente') title('Sumando una fase arbitraria')