フィルターのクリア

Why does my function graph look like a net? How to improve it?

1 回表示 (過去 30 日間)
Tmat
Tmat 2020 年 8 月 19 日
コメント済み: Tmat 2020 年 8 月 21 日
Hi, I tried to plot a vector t against ft, a well-defined function. However after entering the following codes:
figure;plot(t,ft);xlabel('t');ylabel('ft');
I got the following graph, which looks wierd. As for each value t there should be only one value for ft. How could I improve the graph? I attached my data too. Any comments or suggestions are welcome. Thanks!
  1 件のコメント
Tmat
Tmat 2020 年 8 月 19 日
Thanks, Stephan. This solved my problem. I thought the t data was constructed monotone.

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

採用された回答

Stephen23
Stephen23 2020 年 8 月 19 日
編集済み: Stephen23 2020 年 8 月 19 日
"As for each value t there should be only one value for ft."
Each vector contains exactly 1681 elements, so that is true. But the t values are not monotonic increasing:
>> issorted(t)
ans = 0
>> nnz(find(diff(t)<=0))
ans = 40
and MATLAB plots the data in exactly the t-order that you tell it to, as one long zig-zag line. So far everything is working as documented and as expected.
However it appears that the time data repeats block of 41 elements, which I assume is the same for the data vector. If you expect each of those blocks of data to be displayed as a separate line, then the simplest way is to reshape the data into matrices:
>> Mft = reshape(ft,41,41);
>> Mt = reshape(t, 41,41);
>> plot(Mt,Mft)
Giving

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by