Here is my code:
clear all;
%% Load the earthquake data file
load ECE350_Earthquake_Demo.mat
tearth = 0:dt:(length(d)-1)*dt;
t1 = tearth';
%% Play the sound of the earthquake
sound(d, fs)
figure,subplot(3, 1, 1); % 3 subplots in a 3x1 matrix
plot(t1,d) %% plots f(t)
title('First Subplot f(t)')
subplot(3, 1, 2);
plot(t1*2, d) %% plots f(2t)
title('Second Subplot f(2t)')
subplot(3, 1, 3);
plot(t1*(1/2), d) %% plots f(t/2)
title('Third Subplot f(t/2)')
xlim([0 20]);
orient landscape
delete 'Demo_plot1.pdf'
print -dpdf 'Demo_plot1'
This code loads in an earthquake data file and plots the output onto a graph.
I am to plot three different subplots vertically, and plot f(t), f(2t), and f(t/2) respectively.
f(2t) should compress the graph, and f(t/2) should expand the graph, naturally. My code does the opposite - f(2t) compresses, and f(t/2) expands (t1*2 and t1/2 is how I am implementing this).
The output format is fine, and everything works. These two graphs are just switched.
Why is this?