help-octave
[Top][All Lists]

Re: Matrix problem...

 From: Paul Thomas Subject: Re: Matrix problem... Date: Mon, 03 May 2004 20:49:33 +0200 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

```antonio luiz oliveira de noronha wrote:

```
```Hi

Please, I was trying to use octave to make some calculations with
matrices... and i could not... does anyone know how to do this
A*B multiplication ?

| sin(theta)    cos(theta) |       | sin(theta)  sin(theta) |
A=|                          | and B=|                        |
| sin(theta)    cos(theta) |       | sin(theta)  sin(theta) |

Without giving the explicit vallues to theta??

Thanks
```
```Write a function;

function vout = myfunc( theta );
st = sin( theta );
ct = cos( theta );
A = [ st , ct ; st , ct ];
B = [ st , st ; st , st ];
vout = A* B;
endfunction

Alternatively, since all the elements of A * B are the same, use

vout  =  ones( 2 , 2 ) * ( sin( theta ) ^ 2  + sin( 2 * theta )  / 2 ) ;

Paul T

```
```______________________________________________________________________
|                                                                      |
|Antonio Luiz Oliveira de Noronha   -   address@hidden    |
|Theoretical Inorganic Physical Chemistry  -  LQIT                     |
|Chemistry Departament - DQ                                            |
|UFMG - Federal University of Minas Gerais - Brazil                    |
|Av. Antonio Carlos, 6627 - Campus Pampulha                            |
|CEP 31270-901 - Belo Horizonte - MG - Brazil                          |
|VOICE +55 31 499 5776   -   FAX +55 31 499 5700                       |
|______________________________________________________________________|

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```
```

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```