How do I plot different array smoothly which contain NaN in same figure

1 回表示 (過去 30 日間)
Md Hassanuzzaman
Md Hassanuzzaman 2020 年 7 月 4 日
コメント済み: Star Strider 2022 年 6 月 8 日
Plot 4 arrays all of them contain NaN value. How do you plot it smoothly.
Here is the code:
lw=2
plot(Sig1,'LineWidth',lw,'Color',[1 0.76 0])
hold on
plot(Sig2,'r','LineWidth',lw)
hold on
plot(Sig3,'g','LineWidth',lw)
hold on
plot(Sig4,'b','LineWidth',lw)
hold off

回答 (1 件)

Star Strider
Star Strider 2020 年 7 月 4 日
One option is to use the fillmissing function.
Example —
sig1 = [rand(1,10) NaN];
sig2 = [rand(1,10) NaN];
sig3 = [rand(1,10) NaN NaN];
sig4 = [rand(1,10) NaN];
sigv = [sig1 sig2 sig3 sig4];
sigvfm = fillmissing(sigv, 'linear');
figure
plot(sigv, 'b', 'LineWidth',1.5)
hold on
plot(sigvfm,'r')
hold off.
Make appropriate changes to work with your data.
.
  6 件のコメント
Md Hassanuzzaman
Md Hassanuzzaman 2022 年 6 月 8 日
Thanks
Star Strider
Star Strider 2022 年 6 月 8 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by