Home > Archive > Matlab > February 2007 > Gridding Data
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| LindsE 2007-02-23, 7:19 pm |
| Hi there;
I have two matrices of temperature: One has dimensions 10x8043 while
the other has dimensions 10x8046. I have contoured them separately,
both with time in Julian days on the x-axis (8043x1 and 8046x1,
respectively) and depth on the y-axis (both 10x1).
I would like to overlay one plot onto the other, and take the
difference of the two matrices, to see where temperatures are
different.
Would anyone know how to grid the data so that they are the same size?
Thanks;
Lindsay
| |
| Joseph 2007-02-23, 7:19 pm |
| So, why are your matrices different sizes? If one matrix contains a
few extra time points than the other, those time points should be
ignored when subtracting.
LindsE wrote:
>
>
> Hi there;
>
> I have two matrices of temperature: One has dimensions 10x8043
> while
> the other has dimensions 10x8046. I have contoured them
> separately,
> both with time in Julian days on the x-axis (8043x1 and 8046x1,
> respectively) and depth on the y-axis (both 10x1).
>
> I would like to overlay one plot onto the other, and take the
> difference of the two matrices, to see where temperatures are
> different.
>
> Would anyone know how to grid the data so that they are the same
> size?
>
> Thanks;
> Lindsay
>
>
| |
| helper 2007-02-23, 7:19 pm |
| LindsE wrote:
>
>
> Hi there;
>
> I have two matrices of temperature: One has dimensions 10x8043
> while
> the other has dimensions 10x8046. I have contoured them
> separately,
> both with time in Julian days on the x-axis (8043x1 and 8046x1,
> respectively) and depth on the y-axis (both 10x1).
>
> I would like to overlay one plot onto the other, and take the
> difference of the two matrices, to see where temperatures are
> different.
>
> Would anyone know how to grid the data so that they are the same
> size?
>
> Thanks;
> Lindsay
>
>
Take a look at the GRIDDATA function.
| |
| LindsE 2007-02-24, 7:10 pm |
| On Feb 23, 8:08 pm, Joseph <n...@dodo.com> wrote:[color=darkred]
> So, why are your matrices different sizes? If one matrix contains a
> few extra time points than the other, those time points should be
> ignored when subtracting.
>
> LindsE wrote:
>
>
>
>
>
Hi, Joseph;
The matrices are different sizes, just because the second group of
thermistors collected a few extra points than the first group. For
the assignment, I am to use all possible data. I will try ignoring
the points as well, though, thanks for the suggestion.
Lindsay
| |
| LindsE 2007-02-24, 7:10 pm |
| On Feb 23, 9:32 pm, helper <s...@nospam.com> wrote:
> LindsE wrote:
>
>
>
>
>
>
> Take a look at the GRIDDATA function.
Hi, Helper;
Thanks for the advice, but I'm not sure that I entirely understand the
function.
I guess I'll want to fit the second data to the size of the first
data. I tried this:
[X,Y] = meshgrid(Date1,depth1);
Z2=griddata(Date2,depth2,Temps2,X,Y);
I anticipated Z2 to give me a matrix of temperatures to fit the first
data, to be plotted with the resized second data. When I try this, I
get a rather extensive error message. I think I'm lost on what X and
Y should be.
Could someone please explain?
Thanks;
Lindsay
| |
| LindsE 2007-02-24, 7:10 pm |
| On Feb 24, 3:18 pm, "LindsE" <LindsEHill...@gmail.com> wrote:
> On Feb 23, 9:32 pm, helper <s...@nospam.com> wrote:
>
>
>
>
>
>
>
>
>
>
> Hi, Helper;
>
> Thanks for the advice, but I'm not sure that I entirely understand the
> function.
>
> I guess I'll want to fit the second data to the size of the first
> data. I tried this:
>
> [X,Y] = meshgrid(Date1,depth1);
> Z2=griddata(Date2,depth2,Temps2,X,Y);
>
> I anticipated Z2 to give me a matrix of temperatures to fit the first
> data, to be plotted with the resized second data. When I try this, I
> get a rather extensive error message. I think I'm lost on what X and
> Y should be.
>
> Could someone please explain?
>
> Thanks;
> Lindsay
I have also tried this:
xmin = min(Date2);
xmax = max(Date2);
ymin = min(depth2);
ymax = max(depth2);
xres=10;
yres=8046;
% Define the range and spacing of the x- and y-coordinates,
% and then fit them into X and Y
xv = linspace(xmin, xmax, xres);
yv = linspace(ymin, ymax, yres);
[Xinterp,Yinterp] = meshgrid(xv,yv);
% Calculate Z in the X-Y interpolation space, which is an
% evenly spaced grid:
Zinterp = griddata(Date1,depth1,Temps1,Xinterp,Yin
terp);
% Generate the plot
figure
contourf(Xinterp,Yinterp,Zinterp)
An error occurs at the "Zinterp" line.
Lindsay
| |
| helper 2007-02-27, 7:19 pm |
| LindsE wrote:
>
>
> On Feb 24, 3:18 pm, "LindsE" <LindsEHill...@gmail.com> wrote:
dimensions[color=darkred]
> 10x8043
them[color=darkred]
and[color=darkred]
> 8046x1,
take the[color=darkred]
temperatures are[color=darkred]
are the[color=darkred]
> same
> understand the
first[color=darkred]
> first
> this, I
X[color=darkred]
> and
>
> I have also tried this:
>
> xmin = min(Date2);
> xmax = max(Date2);
> ymin = min(depth2);
> ymax = max(depth2);
> xres=10;
> yres=8046;
> % Define the range and spacing of the x- and y-coordinates,
> % and then fit them into X and Y
> xv = linspace(xmin, xmax, xres);
> yv = linspace(ymin, ymax, yres);
> [Xinterp,Yinterp] = meshgrid(xv,yv);
>
>
> % Calculate Z in the X-Y interpolation space, which is an
> % evenly spaced grid:
> Zinterp = griddata(Date1,depth1,Temps1,Xinterp,Yin
terp);
>
>
> % Generate the plot
> figure
> contourf(Xinterp,Yinterp,Zinterp)
>
> An error occurs at the "Zinterp" line.
>
> Lindsay
>
>
This appears to be the correct usage. What is the error message you
are obtaining?
| |
| LindsE 2007-02-28, 8:15 am |
| On Feb 27, 8:27 pm, helper <s...@nospam.com> wrote:
> LindsE wrote:
>
>
>
>
> dimensions
> them
> and
>
> take the
> temperatures are
>
> are the
>
>
>
>
>
> first
>
>
> X
>
>
>
>
>
>
>
>
>
> This appears to be the correct usage. What is the error message you
> are obtaining?
Hi, Helper;
We managed to resolve this in the "meshgrid/griddata" post I made a
couple of days ago. I just had to add:
Zinterp1=griddata(Date2,depth2,Temps2,Xi
nterp1,Yinterp1,'',{'QJ'});
the QJ to my command.
Thanks so much for your concern!
Lindsay
| |
| helper 2007-02-28, 7:14 pm |
| LindsE wrote:
>
>
> On Feb 27, 8:27 pm, helper <s...@nospam.com> wrote:
<LindsEHill...@gmail.com> wrote:[color=darkred]
wrote:[color=darkred]
contoured[color=darkred]
(8043x1[color=darkred]
10x1).[color=darkred]
other, and[color=darkred]
that they[color=darkred]
entirely[color=darkred]
of the[color=darkred]
to fit[color=darkred]
> the
I try[color=darkred]
on what[color=darkred]
y-coordinates,[color=darkred]
> you
>
> Hi, Helper;
>
> We managed to resolve this in the "meshgrid/griddata" post I made a
> couple of days ago. I just had to add:
> Zinterp1=griddata(Date2,depth2,Temps2,Xi
nterp1,Yinterp1,'',{'QJ'});
> the QJ to my command.
>
> Thanks so much for your concern!
> Lindsay
>
>
Ah. Joggling. Aren't computers a pain! Good luck!
|
|
|
|
|