3 subplots of those three intervals in a horizontal line

조회 수: 18 (최근 30일)
Ryan Scott
Ryan Scott 2020년 5월 9일
답변: Akihumi 2020년 5월 9일
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!

답변 (1개)

Akihumi
Akihumi 2020년 5월 9일
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)

카테고리

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