1
votes

There are examples for summation of a vector but not for matrix in Matlab. So please help solve the following:

How to write impulse response function in matlab?

I want program in Matlab for the equation:

hij(t) = ∑_(k=1)to n (φik*φjk*e-xwk*sin(wdk(t))/(M*wdk))
  • h is impulse response function
  • φ is mode shape
  • x is constant
  • wk is kth mode nat frequency
  • wdk is kth mode damped frequency
  • M is mass matrix.
1

1 Answers

1
votes

Summing on a matrix, in general, looks like this:

>> A = randi(5,[3,6]) % Creating a random [3 x 6] integer matrix

A =

     3     4     4     1     2     4
     3     4     4     3     3     2
     4     2     1     5     2     3

>> sum(A)  % Sums on rows (dim=1 is default) so you get a [1 x 6] vector

ans =

    10    10     9     9     7     9

>> sum(A,2) % Sums on columns (dim=2) so you get a [3 x 1] vector

ans =

    18
    19
    17

And similarly if you had a 3D matrix V, then you could do sum(V,3) to sum on the slices.

If you want more specific help, please note the dimensions of each input (phi_i, phi_j, M, w, and wd)