How to plot from certain range of data?

38 ビュー (過去 30 日間)
arymas
arymas 2014 年 12 月 16 日
コメント済み: Image Analyst 2014 年 12 月 20 日
Hi everyone,
Actually I want find the stepinfo value but I have huge amount of data (many square waves of data). As far as I know stepinfo can determine if the signal in one square wave. Therefore I want to plot the data in certain range. The data (x and y) are in same folder of the workspace. What I did is below but did not work.
1.
>> x=Scope1(:,1);
>> x=[10:0.02:20];
>> y=Scope1(:,3);
>> plot(x,y)
Error using plot.
Vectors must be the same lengths.
2.
>> x=Scope1(:,1);
>> xlim=([10 20]);
>> y=Scope1(:,3);
>> plot(x,y)
Number 2 produce no error but it plots whole data (xlim is not functioning).
I also tried with fplot (function, xlim ) but it didn't work (it plot y=x).
>> x=Scope1(:,1);
>> y=Scope1(:,3);
>> fplot('y' , [10 20])
Can anybody help me how to plot?
Thank you in advance!
arys
  2 件のコメント
Star Strider
Star Strider 2014 年 12 月 16 日
Is ‘Scope’ the output of one or more stepinfo calls? We have no idea.
arymas
arymas 2014 年 12 月 17 日
Scope1(:,1) --> is x4 double data which from simulink to workspace. number 1 and 3 are refer to coloum 1 and 3.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2014 年 12 月 16 日
First of all, what is Scope? Is it a 2D array of square wave data where each column is one square wave?
Next, what is stepinfo? And how is it able to determine anything ? Did you write a function called stepinfo?
Then, why do you set x = a column of Scope then overwrite it with a linear vector? So of course x is a different length than y since they are not both columns of Scope anymore.
Why do you want to plot y vs. x anyway? If they're both square waves, what sense would that make?
Then, to set the axes limits you cannot do this
xlim=([10 20]);
You must do it this way:
xlim([10 20]); % No equal sign.
  2 件のコメント
arymas
arymas 2014 年 12 月 17 日
First of all, thank you very much for xlim correction. I will try. Second very sorry for lack of info provided.
Scope1(:,1) --> is x4 double data which from simulink to workspace. number 1 and 3 are refer to coloum 1 (for x) and 3 ( for y). The stepinfo is one of the matlab tools to get control system performance (settling time, overshoot, etc..).
thank you again !
Image Analyst
Image Analyst 2014 年 12 月 20 日
Sorry I can't help - I don't have Simulink or stepinfo.

サインインしてコメントする。


Sudharsana Iyengar
Sudharsana Iyengar 2014 年 12 月 17 日
Did you try the following
x=Scope1(:,1);
y=Scope1(:,3);
plot(x,y)
xlim([10 20])
More easier option would be to use
plot(Scope(:,1),Scope(:,2))
xlim([10 20])

カテゴリ

Help Center および File ExchangeTime and Frequency Domain Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by