Thread Closed

MATLAB building matrix

 
Share Thread
Mar30-09, 12:18 PM   #1
 

MATLAB building matrix


i want to build a matrix that can solve cross product multiplication of 2 vectors, building a matrix A so that

detA=PxS

A=

[tex]\hat{i}[/tex] [tex]\hat{j}[/tex] [tex]\hat{k}[/tex]
P1 P2 P3
S1 S2 S3


how do i build a code so that my det will give me a vector answer?
PhysOrg.com science news on PhysOrg.com

>> New language discovery reveals linguistic insights
>> US official: Solar plane to help ground energy use (Update)
>> Four microphones, computer algorithm enough to produce 3-D model of simple, convex room
Mar30-09, 01:30 PM   #2
 
Why wouldn't you just use MATLAB's built in cross-product?

Doing what you're asking (in MATLAB) is a somewhat complicated problem. It's easy to do this by hand, but MATLAB is a bit different. Think about how you would do this by hand - what are [tex]\hat{i}[/tex], [tex]\hat{j}[/tex], and [tex]\hat{k}[/tex]?

Since each of these is a vector (three components in 3-space), MATLAB won't let you create a matrix containing these vectors - you'll get a dimension mismatch error. What you might be able to do is define symbols (do you have the symbolic math toolbox?) for i, j, and k, and use these in your matrix. This will give you an answer, but it won't be very useful, because you won't be able to operate on your result.

-Kerry
Mar30-09, 01:50 PM   #3
 
thanks, its one of the homework problems i have, using the cross function is much simpler but i am meant to doo it this way.

another problem i need to do is make a table containing
names and ages

name1 48
name2 33
name4 90
...
namen 22

totally randomly, at least 15 names, and then perform a number of tasks on them, is there a way i can tell matlab to make the random table or do i need to plug in all the names and ages, can i make a nx2 matrix where the 1st colomn is made up of words not numbers? also can i tell matlab to make name(n) where n runs from 1->15
Mar30-09, 02:37 PM   #4
 

MATLAB building matrix


Look into the sprintf function - that should do what you need. You can use it in conjuction with randn.

-Kerry
Mar30-09, 02:55 PM   #5
 
thanks a lot, btw i managed the det using
syms i j k
Mar30-09, 03:13 PM   #6
 
still havent managed to build the names matrix
name1 48
name2 33
name4 90
...
namen 22

could you please help, or if possible write the code i need, i didnt really understand the ssprintf function.

even if i try making the matrix it doesnt work, ie
a=['name1' 48; 'name2'.......] i am only managing to make matrices of numbers
Mar30-09, 03:21 PM   #7
 
Can you show me how you're trying to use the sprintf function? I don't understand what problems you're having if you don't show your work. Tell me what you don't understand, what errors your getting, what behavior you want vs. what behavior you're getting.

-Kerry
Mar30-09, 03:26 PM   #8
 
i just dont know what it actually does, what to type to use it, the help fiile didnt really mae sense to me, i am pretty much a matlab novice, only had a couple of lessons so far
Mar30-09, 03:59 PM   #9
 
Scroll to the bottom of the help entry - there are examples there. Try them out. If you still have questions, I will be happy to help. You can cite specific parts of the examples that you don't understand. MATLAB does a very good job with their documentation, and I don't want to just repeat it here. I can give you my own examples, and my own explanation of what it is doing, but if you don't tell me what it is that you don't understand, my explanation will be very similar to what you will find in the MATLAB documentation.

-Kerry
Thread Closed

Similar discussions for: MATLAB building matrix
Thread Forum Replies
Squareing Matrix(?) in MATLAB Math & Science Software 5
Matrix Output (Matlab) Math & Science Software 1
Matlab - matrix expressions Math & Science Software 0
Matrix of ODE's in MATLAB Math & Science Software 2
MATLab matrix question Math & Science Software 1