Set the same y axis scale on two plots

96 次查看(过去 30 天)
Hello everyone!
I have two FFT plots and the y-axes are scaled differently: on one, the numbers are multiplied x10^-5, and on the other x10^-6. How can I plot both axes on the same scale, for example x10^-6, for a better comparison? Attached there's an image that shows the different scales on the y-axis, and here is the code that generates the figure:
figure;
subplot(1,2,1)
plot(f_b, P1_b)
title('FFT for baseline')
xlabel('Frequency')
ylabel('|P1(f)|')
subplot(1,2,2)
plot(f_e, P1_e)
title('FFT for experimental condition')
xlabel('Frequency')
ylabel('|P1(f)|')
Also because after that, I'm planning to get the area under the curve, so it would be easier to have the signals on the same scale.
I hope I was clear enough. Thank you very much in advance for your help!

采纳的回答

KLR
KLR 2020-7-11
编辑:KLR 2020-7-11
Since you are using subplots to plot the data you can use link axis to link the desired axis. Here's the link that explains in more detail. https://www.mathworks.com/help/matlab/ref/linkaxes.html
Or you can manually set the Ylimits for instance in your plot
figure;
subplot(1,2,1)
plot(f_b, P1_b)
title('FFT for baseline')
xlabel('Frequency')
ylabel('|P1(f)|')
subplot(1,2,2)
plot(f_e, P1_e)
% Add a line here to set the y limits
ylim([minimumvalue maximumvalue]) % specify the minimum and maximum value so that both the y axis have the same scale
title('FFT for experimental condition')
xlabel('Frequency')
ylabel('|P1(f)|')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by