For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > i have a vector and matrix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author i have a vector and matrix
davide

2005-11-29, 8:00 am

I have a vector:

P = [1 2 3 ]

And a matrix

Q = [ 1 2 3
3 4 5
6 7 8]

I want to multiply each element of Q by elements of P

For example, from above I would get

Q1 = [1 2 3
3 4 5
6 7 8]
Q2 =[2 4 6
6 8 10
12 14 16]
Q3=[3 6 9
9 12 15
18 21 24]



Thanks for your help,
Davide
Jérôme

2005-11-29, 8:00 am

Hi,

DON'T post multiple messages !

Did you try with a FOR loop ?

Jérôme
davide

2005-11-29, 7:07 pm

Jérôme wrote:
>
>
> Hi,
>
> DON'T post multiple messages !
>
> Did you try with a FOR loop ?
>
> Jérôme


yes I try with a for loop,but it's not correct.
Jérôme

2005-11-29, 7:07 pm

Post your code.

Jérôme
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com