It is possible to use 'polyval' with data containing nan?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Camila Hashimoto
el 9 de En. de 2017
Comentada: Camila Hashimoto
el 9 de En. de 2017
Hi, I want to plot the trend line of 'fice'(856x1), but it has 'nan' from 1:214. When I use 'polyval' the function does not plot the trend line, because it has 'nan's' ...
If I manually put the trend line using 'Tools>Basic Fitting' I can plot the trend line, but it starts from '1' and I want it to start from the '215'
Does anyone have an idea to help me? thanks :)
this is my code...
figure;
aa=[1:(214*4)];
plot(aa',fice,'c');
hold on ;
my_poly=polyfit(aa',fice,1);
X2=215:856; % X data range
Y2=polyval(my_poly,X2);
plot(X2,Y2,'r');%trend line
hold on
plot(Dib,'b'); %plot das áreas normais
hold off
PS: sorry if I have English errors
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de En. de 2017
mask = isnan(fice);
t_aa = aa(~mask);
t_fice = fice(~mask);
my_poly = polyfit(t_aa, t_fice, 1);
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!