I want to build the square wave: build a 6 subplot figure to show the time domain, and use respectively 1, 3, 5, 10, 50, 500 frequencies.How can i achieve this?
1 view (last 30 days)
Image Analyst on 22 Nov 2022
Edited: Image Analyst on 22 Nov 2022
Start with this:
allFreqs = [1, 3, 5, 10, 50, 500];
for k = 1 : length(allFreqs)
thisFreq = allFreqs(k);
subplot(length(allFreqs), 1, k);
% Code to generate Rect want, for you to do.
rectWave = whatever....................
plot(rectWave, 'b-', 'LineWidth', 2);
caption = sprintf('Frequency = %d', thisFreq);
title(caption, 'FontSize', 15);
More Answers (1)
John D'Errico on 22 Nov 2022
Solve a problem that is too large for you to handle by breaking it up into small enough chunks to handle.
- Do you know how to use subplot? Clearly, you know about subplots. So read the help. Look at the examples.
- Do you know how to plot a square wave? It sounds like you are asking how to use an FFT, So learn how to use an FFT to solve the problem for one case, then using a loop, solve it 6 times.