Question

In MATLAB create a sine wave with slow varying frequency. The average freqeuncy is 20hz. The...

In MATLAB create a sine wave with slow varying frequency. The average freqeuncy is 20hz. The slow frequency is 1Hz. The [f min, fmax] = [15, 25]Hz. Plot the waveform, power spectrum, and spectrogram.

Homework Answers

Answer #1

MATLAB code is given below followed by the plots.

The code is in bold letters.

clc;
close all;
clear all;

% Sqweep from 15 Hz to 25 Hz
Fs = 1000;
Ts = 1/Fs;
t = 0:Ts:2;
x = chirp(t,15,2,25);
figure;plot(t,x);xlabel('Time(s)');ylabel('Amplitude');
xlim([-0.1 2.1]);ylim([-1.1 1.1]);grid;
title('sweep of frequencies 15 Hz to 25 Hz');

% Spectrum
X = fft(x);
L = length(X);
P2 = abs(X/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
figure;
plot(f,P1);grid;
title('Single-Sided Amplitude Spectrum Chirp')
xlabel('f (Hz)');xlim([0 50]);
ylabel('Magnitude')


% Spectrogram
F = 0:.1:100;
[y,f,t,p] = spectrogram(x,256,250,F,1E3,'yaxis');
figure;surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time');title('Spectrogram');
ylabel('Frequency (Hz)');

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A single phase AC induction motor need to be controlled by varying its input frequency. The...
A single phase AC induction motor need to be controlled by varying its input frequency. The supply frequency is a single phase with 50 Hz and the input frequency to the motor is controlled to be 12.5 Hz. Design a Full-wave rectifier (Cycloconverter), show the conversion of 5 cycles, and explain its operation. And show how the output voltage of Cycloconverters can be controlled to get a waveform shape near sine wave.
I am using matlab and getting a "matrix dimensions error below" for line 22. Can someone...
I am using matlab and getting a "matrix dimensions error below" for line 22. Can someone spot the error and try the code to fix the error. %The beginning step is to generate a functionf(t) that consists of the sum %of the following components % 25 Hz cosine function of magnitude 1 % 50 Hz sine function of magnitude 1 % 40 Hz square wave function of magnitude 1 clear; clc; close all; %sample rate is given at 2500 Hz...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and save your Matlab code in a script file. i) Cosine signal of frequency 100 Hz over the range [0,0.1] seconds and samples spaced 10^- 4 seconds apart with a phase of pi/2 and an amplitude of 1.   PLEASE USE MAT LAB ONLY. THANK YOU ii) A square wave that oscillates between 0 and 1 every five samples, plot 3 periods of the waveform. iii)...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...