Domanda

I've got these known variables:

T=3;             
t=0:0.01:5*T;    
om=2*pi/T;       
N=10;            
f0=100;          

where:

  • T = period,
  • t = variable time,
  • om = angular frequency,
  • N = number of terms of the series,
  • f0 = starting force (power)

And I am creating vector ft using complex Fourier series like this:

ft=zeros(size(t));
for j=1:2*N+1
    n= j-(N+1);    
    if n==0
        f(j)=f0/2;
    else
        f(j)=f0*((exp(-i*n*2*pi)*(i*2*pi*n+1)-1)/(4*pi^2*n^2));   
    end
    ft=ft+f(j)*exp(i*n*om*t);
end
plot(t,ft);

Result is the following sawtooth wave:

sawtooth wave

Okay, vector ft is complex and my question is: How to interpolate vector ft?

È stato utile?

Soluzione

You can use interp1. If t2 is a vector containing the interpolation times, then:

ft2 = interp1(t, ft, t2);

returns the interpolated points in ft2.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top