Reputation: 145
I have a matrix 2NxN.
And I want get some parametrs by this matrix. For example it:
How, I can do it?
Upvotes: 0
Views: 78
Reputation: 4843
From what I understand here are the first three:
% Random Matrix
% Needs to be defined before the functions since the functions look for
% the m variable
m = rand(12,6);
% Function 1
p = @(i,j) sign(m(i,j)+m(i+1,j)) * max(abs(m(i,j)),abs(m(i+1,j)));
p(2,2)
% Function 2 - Avg of row
pavg = @(i) mean(m(i,:));
pavg(2)
% Function 3
c = @(i,j) abs(m(i,j)+m(i+1,j)) / (abs(m(i,j)) + abs(m(i+1,j)));
c(2,2)
Upvotes: 1
Reputation: 1860
You may want to break your 12x6 matrix, into two 6x6 matrix; let's say: Z
and Zb
(last one for z bar). Odd rows are Z
and evens are Zb
.
Considering M
to be the combined matrices:
Z = M(1:2:end,:)
Zb = M(2:2:end,:)
read about the colon(:
) operator and end
to see what 1:2:end
means.
Hope it helps.
Upvotes: 1