plotting a 1*1 matrix

7 ビュー (過去 30 日間)
Ioannis
Ioannis 2014 年 1 月 12 日
回答済み: Paul 2014 年 1 月 12 日
Hi i want to plot a 1x1 matrix with time but i keep getting the same error ??? Error using ==> plot Invalid property found. Object Name : line Property Name : 'time'. My matrix has 10028 data,it's name is current and the code is the follownq: t=1:0.001:10; plot(t,current)

採用された回答

Mischa Kim
Mischa Kim 2014 年 1 月 12 日
編集済み: Mischa Kim 2014 年 1 月 12 日
First, t and current need to be of same size, both 1x10028 (or 10028x1) vectors. So, for example, use
t = linspace(1,10,10028);
plot(t, current);
Note, that in the above case, time is an evenly spaced vector, starting at t=1 and ending at t=10 .
  2 件のコメント
Ioannis
Ioannis 2014 年 1 月 12 日
i used your code but i still have tha same error :s ??? Error using ==> plot Invalid property found. Object Name : line Property Name : 'time'. i got the matrix form simulink and i just want to plot it with time
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 12 日
編集済み: Azzi Abdelmalek 2014 年 1 月 12 日
If you still have the same problem, why did you accept the answer?

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

その他の回答 (3 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 12 日
The size of t and current aren't the same. Look at this example
t=1:0.001:10;
current=sin(t);
plot(t,current)
When you type in command windows
whos current
What did you get?
  2 件のコメント
Ioannis
Ioannis 2014 年 1 月 12 日
my problem is that a get the file from simulink and i just want to plot it.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 12 日
編集済み: Azzi Abdelmalek 2014 年 1 月 12 日
Ok , then when you type
whos current
What did you get?

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


Image Analyst
Image Analyst 2014 年 1 月 12 日
編集済み: Image Analyst 2014 年 1 月 12 日
If you do
t=1:0.001:10
then t has 9001 elements, not 10028. If you want 10028 then do this
t = linspace(1, 10, 10028);
plot(t, current, 'b-', 'LineWidth', 2);
Ot, maybe current is a structure. Try whos current and see what it says. Is it a 10028 by 1 array?
And you might have an m-file called plot or current hanging around somewhere. What do these two lines report
which -all plot
which -all current

Paul
Paul 2014 年 1 月 12 日
If your data is from simulink, it's probably a structure with time. To plot your data you have to do:
plot(current.time,current.signals.values)
You can change what type of data simulink outputs by double clicking the output block and setting it for example to array. Then you won't have a structure but a simple array. To also output the time, you can just put a clock (block) in simulink and connect to an output block with an array type named t or something. Then you can plot the data by doing:
plot(t,current)

カテゴリ

Help Center および File ExchangeScopes and Data Logging についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by