Clear Filters
Clear Filters

what does this code mean?

1 view (last 30 days)
Ruben Verkempynck
Ruben Verkempynck on 2 May 2011
Hey everybody, I copied a piece of code and I am trying to translate this code to formulas in excel but I am having a hard time trying to transform this part of code:
SSB(t)=((N(:,t).*exp((-FKA*f)+(-M02*m))).*MAKA)'*WAKA;
N is 9 x 31 FKA is 9 x 1 M02 is 9 x 1 MAKA is 9 x 1 WAKA is 9 x 1
Can anyone explain to me the steps in this column? And what do the stars and dots mean?
Cheers, Ruben

Accepted Answer

Paulo Silva
Paulo Silva on 2 May 2011
. before operation means that the operation is element wise
[a b].*[c d]=[a*c b*d]
' means transpose (columns turn into rows and rows into columns)
[a b]'=[a;b]
: means every element of column or row, it depends if it's before or after the comma, there are also other uses.
M(:,1) means all rows of column 1 and M(1,:) means all columns of row 1
M(:) means all elements of the array M
It can also be used to create vectors like this
v=1:0.1:10; %creates a vector with elements starting at 1 with 0.1 increment and ending at 10
M(1:10); %get the first 10 elements of the array M
Now you can understand your expression, I won't do it because by doing it you will learn better.
  2 Comments
Oleg Komarov
Oleg Komarov on 2 May 2011
You meant [a*c b*d]
Paulo Silva
Paulo Silva on 2 May 2011
yes thanks, silly typo lol

Sign in to comment.

More Answers (0)

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!