MrPitivier
MrPitivier

Reputation: 71

How to interpolate vector in Matlab?

I've got these known variables:

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

where:

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?

Upvotes: 0

Views: 685

Answers (1)

Simon
Simon

Reputation: 32893

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.

Upvotes: 2

Related Questions