Matlab interpolation of 4D scattered data
We have a 195x4 (double) matrix: A=[X Y Z temp]
, when ploted with scatter3(A(:,1), A(:,2), A(:,3),30, A(:,4), 'filled' )
gives something like this:
Now we want to generate a 'cube' colored with the interpolation of the temp=A(:,4)
vector data.
So far we have tried interp3
% Base Grid
[Xm Ym Zm] = meshgrid(A(:,1), A(:,2), A(:,3));
% Grid Refinement
[Xq,Yq,Zq] = meshgrid(xmin:dx:xmax, ymin:dy:ymax, zmin:dz:zmax);
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
Returns the following error:
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions
(NDIMS) of these arrays.
Error in interp3 (line 144)
F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in PDGEM_MT (line 112)
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
So I think, may be a bad implementation and/or a wrong interpretation of the problem.
How to generate a 'cube'of that space colored with the volume interpolation of A(:,4)
?
Thanks in advance.
matlab 3d grid interpolation 4d
add a comment |
We have a 195x4 (double) matrix: A=[X Y Z temp]
, when ploted with scatter3(A(:,1), A(:,2), A(:,3),30, A(:,4), 'filled' )
gives something like this:
Now we want to generate a 'cube' colored with the interpolation of the temp=A(:,4)
vector data.
So far we have tried interp3
% Base Grid
[Xm Ym Zm] = meshgrid(A(:,1), A(:,2), A(:,3));
% Grid Refinement
[Xq,Yq,Zq] = meshgrid(xmin:dx:xmax, ymin:dy:ymax, zmin:dz:zmax);
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
Returns the following error:
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions
(NDIMS) of these arrays.
Error in interp3 (line 144)
F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in PDGEM_MT (line 112)
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
So I think, may be a bad implementation and/or a wrong interpretation of the problem.
How to generate a 'cube'of that space colored with the volume interpolation of A(:,4)
?
Thanks in advance.
matlab 3d grid interpolation 4d
add a comment |
We have a 195x4 (double) matrix: A=[X Y Z temp]
, when ploted with scatter3(A(:,1), A(:,2), A(:,3),30, A(:,4), 'filled' )
gives something like this:
Now we want to generate a 'cube' colored with the interpolation of the temp=A(:,4)
vector data.
So far we have tried interp3
% Base Grid
[Xm Ym Zm] = meshgrid(A(:,1), A(:,2), A(:,3));
% Grid Refinement
[Xq,Yq,Zq] = meshgrid(xmin:dx:xmax, ymin:dy:ymax, zmin:dz:zmax);
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
Returns the following error:
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions
(NDIMS) of these arrays.
Error in interp3 (line 144)
F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in PDGEM_MT (line 112)
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
So I think, may be a bad implementation and/or a wrong interpretation of the problem.
How to generate a 'cube'of that space colored with the volume interpolation of A(:,4)
?
Thanks in advance.
matlab 3d grid interpolation 4d
We have a 195x4 (double) matrix: A=[X Y Z temp]
, when ploted with scatter3(A(:,1), A(:,2), A(:,3),30, A(:,4), 'filled' )
gives something like this:
Now we want to generate a 'cube' colored with the interpolation of the temp=A(:,4)
vector data.
So far we have tried interp3
% Base Grid
[Xm Ym Zm] = meshgrid(A(:,1), A(:,2), A(:,3));
% Grid Refinement
[Xq,Yq,Zq] = meshgrid(xmin:dx:xmax, ymin:dy:ymax, zmin:dz:zmax);
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
Returns the following error:
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions
(NDIMS) of these arrays.
Error in interp3 (line 144)
F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in PDGEM_MT (line 112)
Aq = interp3(Xm,Ym,Zm,A(:,4),Xq,Yq,Zq);
So I think, may be a bad implementation and/or a wrong interpretation of the problem.
How to generate a 'cube'of that space colored with the volume interpolation of A(:,4)
?
Thanks in advance.
matlab 3d grid interpolation 4d
matlab 3d grid interpolation 4d
edited Nov 21 '18 at 3:33
asked Nov 21 '18 at 2:10
cavereaper
225
225
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You have an scattered dataset.
interp3
does only work if your data points are in meshgrid format read this. The short description of this function is Interpolation for 3-D gridded data in meshgrid format
Instead you can use griddata
which works for scattered data read this. The short description is Interpolate 2-D or 3-D scattered data
.
Example:
X = rand(100,1);
Y = rand(100,1);
Z = rand(100,1);
C = rand(100,1);
figure
scatter3(X, Y, Z,30, C, 'filled' )
[Xm, Ym, Zm] = meshgrid(min(X):.01:max(X), min(Y):.01:max(Y), min(Z):.01:max(Z));
Cm = griddata(X,Y,Z,C,Xm,Ym,Zm);
figure
scatter3(Xm(:), Ym(:), Zm(:), 30, Cm(:), 'filled' )
Data points:
Interpolated:
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404381%2fmatlab-interpolation-of-4d-scattered-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have an scattered dataset.
interp3
does only work if your data points are in meshgrid format read this. The short description of this function is Interpolation for 3-D gridded data in meshgrid format
Instead you can use griddata
which works for scattered data read this. The short description is Interpolate 2-D or 3-D scattered data
.
Example:
X = rand(100,1);
Y = rand(100,1);
Z = rand(100,1);
C = rand(100,1);
figure
scatter3(X, Y, Z,30, C, 'filled' )
[Xm, Ym, Zm] = meshgrid(min(X):.01:max(X), min(Y):.01:max(Y), min(Z):.01:max(Z));
Cm = griddata(X,Y,Z,C,Xm,Ym,Zm);
figure
scatter3(Xm(:), Ym(:), Zm(:), 30, Cm(:), 'filled' )
Data points:
Interpolated:
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
add a comment |
You have an scattered dataset.
interp3
does only work if your data points are in meshgrid format read this. The short description of this function is Interpolation for 3-D gridded data in meshgrid format
Instead you can use griddata
which works for scattered data read this. The short description is Interpolate 2-D or 3-D scattered data
.
Example:
X = rand(100,1);
Y = rand(100,1);
Z = rand(100,1);
C = rand(100,1);
figure
scatter3(X, Y, Z,30, C, 'filled' )
[Xm, Ym, Zm] = meshgrid(min(X):.01:max(X), min(Y):.01:max(Y), min(Z):.01:max(Z));
Cm = griddata(X,Y,Z,C,Xm,Ym,Zm);
figure
scatter3(Xm(:), Ym(:), Zm(:), 30, Cm(:), 'filled' )
Data points:
Interpolated:
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
add a comment |
You have an scattered dataset.
interp3
does only work if your data points are in meshgrid format read this. The short description of this function is Interpolation for 3-D gridded data in meshgrid format
Instead you can use griddata
which works for scattered data read this. The short description is Interpolate 2-D or 3-D scattered data
.
Example:
X = rand(100,1);
Y = rand(100,1);
Z = rand(100,1);
C = rand(100,1);
figure
scatter3(X, Y, Z,30, C, 'filled' )
[Xm, Ym, Zm] = meshgrid(min(X):.01:max(X), min(Y):.01:max(Y), min(Z):.01:max(Z));
Cm = griddata(X,Y,Z,C,Xm,Ym,Zm);
figure
scatter3(Xm(:), Ym(:), Zm(:), 30, Cm(:), 'filled' )
Data points:
Interpolated:
You have an scattered dataset.
interp3
does only work if your data points are in meshgrid format read this. The short description of this function is Interpolation for 3-D gridded data in meshgrid format
Instead you can use griddata
which works for scattered data read this. The short description is Interpolate 2-D or 3-D scattered data
.
Example:
X = rand(100,1);
Y = rand(100,1);
Z = rand(100,1);
C = rand(100,1);
figure
scatter3(X, Y, Z,30, C, 'filled' )
[Xm, Ym, Zm] = meshgrid(min(X):.01:max(X), min(Y):.01:max(Y), min(Z):.01:max(Z));
Cm = griddata(X,Y,Z,C,Xm,Ym,Zm);
figure
scatter3(Xm(:), Ym(:), Zm(:), 30, Cm(:), 'filled' )
Data points:
Interpolated:
answered Nov 21 '18 at 8:43
user7431005
980316
980316
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
add a comment |
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
worked like a charm. Vielen Dank, Sie sind sehr nett.
– cavereaper
Nov 21 '18 at 18:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404381%2fmatlab-interpolation-of-4d-scattered-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown