DSPRelated.com
Forums

covariance matrices with cov()

Started by Juan Vesa August 16, 2010
hi,
i'm trying to verify some other code i've written in c for
calculating the covariance of 2 nxm matrices (n points in m
dimensions (i.e. 3)) using matlabs cov() command,
when i calculate say cov(a), the resulting matrix is mxm matrix and i
verify that my results are the same as matlabs,
but calculating the cov(a,b) of two different matrices or even cov(a,
a) of the same matrix i get an (m-1)x(m-1) matrix back and i'm
stumped as to the results,
could someone be so kind as to explain matlabs result to me?
regards,
Hi folks,

I got stuck in this problem: I have a figure and throughout my script, the
figure is being changed. How can I capture all changes in the figure (sample it)
and make them an animation (gif or avi formatted), as if the Matlab function
"getframe" works continuously?

Cheers,

Tolga
Hej Tolga !

I think, you can save all the figure as images in your code.
saveas(gcf,['./Saved_Figure_',num2str(n),'_position.png'])

Then, read those images and save as movie.
clear all; close all; clc

for n=1:54
eval(['x=imread(''./Saved_Figure_',num2str(n),'_position.png'');'])
M(n)=im2frame(x);
end
[h, w, p] = size(M(1).cdata); % use 1st frame to get dimension
hf = figure;
% resize figure based on frame's w x h, and place at (150, 150)
set(hf, 'position', [120 120 w h]);
axis off
% tell movie command to place frames at bottom left
movie(hf,M,1,3,[0 0 0 0]);
movie2avi(M,'filename','fps',3)

As to what these commands do, better read the MATLAB help docs.
Good Luck.

Cheers,
Tilak

2010/8/16 Tolga kurt

> Hi folks,
>
> I got stuck in this problem: I have a figure and throughout my script, the
> figure is being changed. How can I capture all changes in the figure (sample
> it) and make them an animation (gif or avi formatted), as if the Matlab
> function "getframe" works continuously?
>
> Cheers,
>
> Tolga
>
>
>