フィルターのクリア

How to plot a line with discontinuity

38 ビュー (過去 30 日間)
Rawan Alghamdi
Rawan Alghamdi 2018 年 7 月 1 日
回答済み: Allen Denny 2020 年 9 月 12 日
I need to plot a discontinuous line, I saw some of the answers but they dont fit to my problem. I have the following data: >> x= [ 5 15 30 50 80 115]; >> d= [ 0.9901 1.0184 0.8291 2.2491 NaN 0.0738]; and I need the graph to appear as a continuous line for the first 4 elements, then a gap, then the last element. What i get when I do >> plot(x,y) is a line the breaks at the fourth element and that is it

採用された回答

Jan
Jan 2018 年 7 月 1 日
編集済み: Jan 2018 年 7 月 1 日
The problem is (at least I assume this), that you cannot see the last element. This happens, because it is a scalar. Such "points" are not visible in a line plot, because they do not have an extend.
x = [ 5 15 30 50 80 115];
d = [ 0.9901 1.0184 0.8291 2.2491 NaN 0.0738];
plot(x, d)
But you can draw the points also, which might be the better choice at all for a discontinuous signal:
plot(x, d, '-o')
Unfortunately you did not mention, how you want to look the output like.

その他の回答 (1 件)

Allen Denny
Allen Denny 2020 年 9 月 12 日
curve fit your data in matlab using curve fitting app in matlab and then plot the function

カテゴリ

Help Center および File Exchange2-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