# continuous representation (image generation) of discrete data set

15 ビュー (過去 30 日間)
AAS 2020 年 9 月 12 日

I have a discrete data set which contains x and y position and velocity. I usually use patch plot to represent this. Is there a continuous way to represent the data? Something that looks like this : https://quickersim.com/flow-porous-media-matlab-quic

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

### 採用された回答

Image Analyst 2020 年 9 月 12 日
It looks like there is a whole toolbox at that site. Did you look it over for functions that might do that? Otherwise, see my attached scatteredInterpolant demo.

#### 4 件のコメント

Image Analyst 2020 年 9 月 18 日
What does resizem() do?
AAS 2020 年 9 月 18 日
Sorry, it should be imresize()
Image Analyst 2020 年 9 月 18 日
The demo works. Here is the main part:
%================================ MAIN PART RIGHT HERE ==============================================
% Create the scattered interpolant. x, y, and gray levels must be column vectors so use (:) to make them column vectors.
% And grayLevels must be double or else an error gets thrown.
F = scatteredInterpolant(xAll(:), yAll(:), double(grayLevelsAll(:)))
% The above line creates an interpolant that fits a surface of the form v = F(x,y).
% Vectors x and y specify the (x,y) coordinates of the sample points.
% v is a vector that contains the sample values associated with the points (x,y).
% Get a grid of points at every pixel location in the RGB image.
[xGrid, yGrid] = meshgrid(1:columns, 1:rows);
xq = xGrid(:);
yq = yGrid(:);
% Evaluate the interpolant at query locations (xq,yq).
vq = F(xq, yq);
fittedImage = reshape(vq, rows, columns);
%================================ END OF MAIN PART ==============================================
You need xq and yq to be vectors, not images like you had. Also you forgot to do reshape to turn it back into an image.
V=F(x2(:),z2(:));
fittedImage = reshape(V, 1000, 1000);

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

### その他の回答 (1 件)

Matt J 2020 年 9 月 12 日
You can use griddedInterpolant() if your x,y are gridded sample locations, or else scatteredInterpolant().

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

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by