Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: plotting and cross-correlation
Replies: 4   Last Post: Feb 25, 2013 1:19 PM

 Messages: [ Previous | Next ]
 steffi Posts: 5 Registered: 4/27/12
Re: plotting and cross-correlation
Posted: May 8, 2012 6:03 AM

"Matt J" wrote in message <joafug\$qib\$1@newscl01ah.mathworks.com>...
> "shaula nataya" <swl100789@gmail.com> wrote in message <joa78v\$nqu\$1@newscl01ah.mathworks.com>...
> > Hello,
> > I have thickness thermocline data (meter) and Ocean Dipole Index (IOD) from 2000-2009 (the data are monthly). I want to draw the plot and calculate the correlation between the two data and show the correlation value on the plot. Can you guys help me with this?

> ==============
>
> Why isn't as simple as using the PLOT command?
>
>

> > And I don't have any idea about what formula that have to be used on the correlation.
> ===============
>
> Why isn't it as simple as using XCORR or CONV?

===========================================
I already do with plot command and corrcoef but I got confused with it and I can't show the correlation value on the plot.

below are the script :
y1 = xlsread('upper.xlsx', 'upper - IOD', 'F26:F37'); %upper
y2 = xlsread('upper.xlsx', 'upper- IOD', 'G26:G37'); %IOD
x = xlsread('upper.xlsx', 'upper - IOD', 'B26:B37'); %time

%plot
[ax,h1,h2] = plotyy(x,y1,x,y2,'plot');

set(get(ax(1),'ylabel'),'string','Depth (m)')
set(get(ax(2),'ylabel'),'string','IOD')
xlabel('month')
title('Upper Layer - IOD Tahun 2002')
set(h1,'linestyle',':')
set(h2,'linestyle','-.')
legend('Upper Layer','IOD')

%korelasi
C=corrcoef(y1,y2);
r = C(2,1);

cheers.

Date Subject Author
5/8/12 steffi
5/8/12 Matt J
5/8/12 steffi
8/8/12 Greg Heath
2/25/13 Ferhat Gilbert