필터 지우기
필터 지우기

Plot text file

조회 수: 3 (최근 30일)
Aike
Aike 2011년 9월 10일
I have a problem on plotting text data. I save it as .dat file. And then I use this code to plot data:
load tec.dat;
Time = tec(:,1)/3600;
Vtec = tec(:,2);
plot(Time,Vtec,'k');
My sampling y data is discontinuous. For example, the sampling time at 12000 second has y = 20.05. Then, the data skipped to the sampling time 57840 second that y = 6.14 (no data from 12000 - 57840 second). In fact, Matlab should not plot the y data between 12000 - 57840 second. However, Matlab also plots trend of the data from 12000 - 57840 second by itself as a linear line. How can I solve this problem?
  댓글 수: 1
Rick Rosson
Rick Rosson 2011년 9월 10일
Please format your code. If you do not know how, please click on the link called "Markup help" (below).

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

답변 (1개)

Rick Rosson
Rick Rosson 2011년 9월 10일
There are several ways to do this.
One very easy method is to use the stem function instead of the plot function:
stem(Time,Vtec,'k');
Another method would be to insert the value NaN into the data vector at time steps where you have no valid data. You would also have to insert a corresponding time value (an actual number) in the time vector so that the time and data vectors would have the same size.
HTH.
Rick

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by