필터 지우기
필터 지우기

plotting a temperature graph over a data of years

조회 수: 5 (최근 30일)
nouman shehzad
nouman shehzad 2019년 6월 22일
댓글: Fikret Dogru 2019년 6월 27일
i have data of about 18 years i want to make a temperature graph versus time.
my matlab code for doing this is
temp=dataa(:,2)
time=dataa(:,1)
plot(time,temp)
i am getting very complex graph which is hard to interpret anything so i need assistance in doing this work. the file having the years data with temperature is attached.
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 22일
편집: KALYAN ACHARJYA 2019년 6월 22일
Look for bar plot, which may be easier to interpret. x axis time and y axis temp. Though the data set is quite long, is it date wise/ min / hour?

댓글을 달려면 로그인하십시오.

답변 (1개)

Fikret Dogru
Fikret Dogru 2019년 6월 22일
Could you show the plot to give you feedback?
  댓글 수: 3
nouman shehzad
nouman shehzad 2019년 6월 25일
the data is is arranged yearwise and we have to show the plot temperature vs year. can u please tell me by writing the code that how we can plot it.?
Fikret Dogru
Fikret Dogru 2019년 6월 27일
Thanx for showing the plot. First you should convert your date using date2num then
Dates for example 20160702 means 2016 year 07 month 02 day
Dates=str2num("your dates");
yy=round(Dates./10000);
mm=round((Dates-yy.*10000)./100);
dd=round((Dates-yy.*10000-mm.*100))
xti=datetime(yy,mm,dd);xtime=datenum(xti);;
h1=plot(xtime,"your variable (temperatures)");
hold on
datetick('x','mmm','keepticks')
mmm gives only months with 3 character if you want to yearly make it
datetick('x','yyyy','keepticks') there are several options can u find in the help yyyy-MMM or etc.
Hope it helps u.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by