Filter löschen
Filter löschen

How to smooth the NaN values in the contour plot?

7 Ansichten (letzte 30 Tage)
shravani banerjee
shravani banerjee am 21 Jan. 2019
Hi I have a csv file attached and I have to plot a contour plot w.r.t date time and z values. It contains some blank data which the Matlab takes as NaN. When I am plotting I am not getting a smooth curve around the NaN values as other values. Can anyone help me out?Screenshot (5).png
fid=fopen('D:\NSSS_2019\INSAT_3D.csv');
for i=1
tline=fgets(fid);
end
data=textscan(fid,'%s %s %f %f %f %f %f %f %f %f','Delimiter',',');
x=data{1,1}; y=data{1,2}; z=data{1,3};
day={};
for i=1:length(x)
p=x(i); p=char(p);
n='00:00';
% m=y(i); m=char(m);
% len=length(m);
%
% if len<5
% n=strcat('0',m);
% else
% n=m;
% end
d=strcat(p,n);
day{i}=d;
end
day=day';
day1=datenum(day,'dd');
newStr = strrep(y,':','.');
time1=[];
for k=1:length(newStr)
aa=newStr(k);
new=str2num(char(aa));
time1(k)=new;
end
time1=time1';
% Grid
x0 = min(day1) ; x1 = max(day1) ;
y0 = min(time1) ; y1 = max(time1) ;
N = 1443 ;
xl = linspace(x0,x1,N) ;
yl = linspace(y0,y1,N) ;
[X,Y] = meshgrid(xl,yl) ;
%% do inteprolation
P = [day1,time1] ; V = z ;
F = TriScatteredInterp(P,V) ;
F.Method = 'natural';
pq = [X(:),Y(:)] ;
vq = F(pq) ;
Z = vq ;
Z = reshape(Z,size(X)) ;
contourf(X,Y,Z);

Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by