3 subplots of those three intervals in a horizontal line

18 vues (au cours des 30 derniers jours)
Ryan Scott
Ryan Scott le 9 Mai 2020
clear;
clc;
X = readtable('FinalProj_TVdata.csv');
Y = readtable('FinalProj_Pdata.csv');
%Convert from Fahrenheit to Kelvin
TempK = ((X{:,1}-32)*5/9)+273.15;
time = 1:300;
%Temperature vs time graph 1
figure(1)
plot(TempK,time);
title('Temperature vs Time')
xlabel('Temperature(Kelvin)')
ylabel('Time(days)')
%Defining symbols for different intervals
t1 = 1:100;
t2 = 101:200;
t3 = 201:300;
A = TempK(1:100);
B = TempK(101:200);
C = TempK(201:300);
%Graph 2 of intervals
figure(2)
plot(A,t1)
hold on
plot(B,t2)
plot(C,t3)
hold off
title('Temperature vs Time intervals')
xlabel('Temperature(Kelvin)')
ylabel('Time(days)')
legend({'y = t1','y = t2', 'y = t3'},'Location','northeast')
I am trying to graph the 3 sub intervals into a horizontal line. Can anyone please help me with that? Thank you!

Réponses (1)

Akihumi
Akihumi le 9 Mai 2020
Do you mean using something like subplot?
Eg:
figure
subplot(1,3,1)
plot(x,A)
subplot(1,3,2)
plot(x,B)
subplot(1,3,3)
plot(x,C)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by