Deformation of surface induced by Cubic interpolation

3 ビュー (過去 30 日間)
Julien Maxime
Julien Maxime 2022 年 10 月 5 日
コメント済み: Julien Maxime 2022 年 10 月 5 日
Hello,
I am currently interpolating heatmap-style data overtime to make 3D surfaces. On the left are raw data and right interpolated ones (surface on top and colorfill on bottom).
As seen in the left image, using the 'linear' method works fine but data still look too sharp for me. However, when trying the 'cubic' method, it deforms the geometry of the dataset.
It is problem solvable with cubic interpolation ? I tried others methods but none other are suited to my data.
Thank you very much,
  2 件のコメント
Julien Maxime
Julien Maxime 2022 年 10 月 5 日
Yes I know i have noisy data. And yes I indeed use the interp2 function with the 'cubic' method.
By the way the method named 'spline' gives me abberant data which is normal as my range cross over 0. But I could not find what the 'cubic' function is exactly.
The goal is of course not to interpolate NaN data and respect edge shape. In linear it works fine but then am I doomed to edge deformation when using cubic method ? What do you advise me then ?
I give you some relevant part of code with comments. It corresponds to the initialisation of uifigure.
"data" is the 3D matrix comprising series of heatmaps with respect to frame number (z dimension).
%Intialisation interpolation 2nd layer data (Frame #2)
[Xq,Yq] = meshgrid(1:0.1:12);
Vq = interp2(data(:,:,2),Xq , Yq, 'linear');
%Creation of surface plot of InterP data (Initialisation)
heatObj1 = surf(ax1, Xq, Yq, Vq, "EdgeColor", 'none');
set(ax1.Title,'String',sprintf('Electrode Fluorescence Interpolated Surface - Frame 2'));
set(ax1,'Ydir','reverse'); %Same angle as raw heatmap
%Fixation des valeurs de z
zlim(ax1,[-400 300]);
%Fixation de la range de couleur
clim(ax1,[-400 300]);
%Creation of colorfill plot of InterP data (Initialisation)
heatObj2 = pcolor(ax2, Xq, Yq, Vq);
set(ax2.Title,'String',sprintf('Electrode Fluorescence Interpolated Heatmap - Frame 2'));
set(ax2,'Ydir','reverse'); %Same angle as raw heatmap
set(ax2,'Color','k')
set(heatObj2,'edgecolor','none')
colormap(ax2, turbo)
zlim(ax2,[-400 300]);
clim(ax2,[-400 300]);
%Creation of surface plot of Raw data (Initialisation)
heatObj3 = surf(ax3, data(:,:,2));
set(ax3,'Ydir','reverse'); %Same angle as raw heatmap
set(ax3.Title,'String',sprintf('Electrode Fluorescence Raw Surface - Frame 2'));
%Fixation des valeurs de z
zlim(ax3,[-400 300]);
%Fixation de la range de couleur
clim(ax3,[-400 300]);
%Creation of heatmap plot of Raw data (Initialisation)
heatObj4 = heatmap(uip, data(:,:,2),'Colormap', turbo,'CellLabelColor', 'none','ColorLimits', [-400 300]);
heatObj4.Title = 'Electrode Fluorescence Raw Heatmap - Frame 2';

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

回答 (0 件)

カテゴリ

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by