79632276

Date: 2025-05-21 15:11:45
Score: 0.5
Natty:
Report link

Replacing your line

[f,F2_x_f]=fourier(t_real,y,'sinus');

with

L=numel(t_real);
Fs=1/step_t;
f = Fs*(0:(L/2))/L;
F_x_f = fft(y,numel(f));
P2 = abs(F_x_f/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);

I obtain a slightly different phase

figure 1

zoomed in

figure 2

I also moved the head line of graph 4 from Y axis to graph top,

..
% plot the phase spectrum
figure(3)
ax3=gca
plot(ax3,f,angle(F_x_f))
grid on
xlim([0,20])
xlabel('f[Hz]'); ylabel('[°]')
title('Phase spectrum of the force in °')
..

so all the readers of your question can comfortably read it.

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: John Bofarull Guix