How to plot a color shade instead of graph curves?

2 ビュー (過去 30 日間)
Nisar Ahmed
Nisar Ahmed 2022 年 4 月 19 日
コメント済み: Nisar Ahmed 2022 年 4 月 19 日
Hi,
I have say a lot of vertical curves overlapping each other as shown in te figure below: FIG 1, I want to plot them like color shade an example is shown below in FIG 2. How I can do it?
FIG 1
FIG 2
  5 件のコメント
Image Analyst
Image Analyst 2022 年 4 月 19 日
@Nisar Ahmed make it EASY for people to help you and they will. If you don't want to share your actual data, then make up something, like a for loop where you create a bunch of noisy sine waves or something. Don't make other people do that just to help you. You should do that for them, otherwise they'll just move on to another question.
There is nothing built in to MATLAB that does that so you'll have to use custom code. I know there was a question on that a few years ago and I answered it but I don't have the link right now.
Nisar Ahmed
Nisar Ahmed 2022 年 4 月 19 日
@Image Analyst Here is data attached in the comment. p0 versus t.

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

回答 (2 件)

Nisar Ahmed
Nisar Ahmed 2022 年 4 月 19 日
Hei @Image Analyst here are two data sets I have prepared. You can use any of them to create figure like (FIG 2). These datasets are attached here in the comment.

KSSV
KSSV 2022 年 4 月 19 日
How about this approach?
load('p0_t.mat') ;
x = t ;
y0 = min(p0(:)) ;
y1 = max(p0(:)) ;
y = linspace(y0,y1,300) ;
[X,Y] = meshgrid(x,y) ;
Z = NaN(size(X));
tt = repelem(t,7,1) ;
tt = tt' ;
m = 70 ; % can be changed
idx = knnsearch([X(:) Y(:)],[tt(:) p0(:)],'k',m) ;
for i = 1:m
Z(idx(:,i)) = p0(:) ;
end
p = pcolor(X,Y,Z) ;
p.EdgeColor = 'none' ;
  1 件のコメント
Nisar Ahmed
Nisar Ahmed 2022 年 4 月 19 日
@KSSV Is it possible to get with more close upper and lower limits with high resolution that also follow the small fluctuations... See the results with your code below. It more blur with respect to actual plot.
I have attached the actual data in refined form, can you try with it.

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

カテゴリ

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