Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Linear Chirp Matlab

Status
Not open for further replies.

b4bb4ge

Full Member level 2
Joined
Feb 28, 2008
Messages
128
Helped
30
Reputation
60
Reaction score
16
Trophy points
1,298
Location
Colorado, USA
Activity points
2,050
Hello,

I am sorry for what seems to me like a beginner question but I can not seem to figure it out. I am trying to linearly increase a signal frequency from 50Hz to 100Hz but when I do this it does not seem to work. Here is my code and the lines in bold are the lines that are linearly increasing the frequency from 50Hz to 100Hz.

clear all;
close all;
Fs = 20000; % Samples Per Second
T = 1/Fs; % Sample time
time = 10; % seconds
t = linspace(0,time,Fs*time); % Time vector
freq_increase = linspace(50,100,length(t)); % frequency increase
y = sin(2*pi*t.*freq_increase); % frequency with frequency increase

plot(t,y)
axis([9.9 10 -1 1]

However if you do the FFT of this you will see that the frequency increases from 50Hz to 150Hz why is this?


NFFT = 2^nextpow2(length(t)); % Next power of 2 from length of y
Y = fft(y,NFFT)/length(t); %fft of signal vector
f = Fs/2*linspace(0,1,NFFT/2+1); %set correct frequency
figure
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
axis([0 200 0 .1])

If I replace the code with this

freq_increase = linspace(50,75,length(t)); % frequency increase
y = sin(2*pi*t.*freq_increase); % frequency with frequency increase

The frequency increase from 50Hz to 100Hz. Why is this code working and the previous code not working? I would expect for y = sin(2*pi*f*t) where f is the frequency. however as you can see the upper frequency is not relating to this but the lower frequency is relating to this?

Thank you for your help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top