Program For Matrix Composition, Classpad
#1
Posted 08 February 2010 - 11:46 PM
The program first requests the number (n) of matrixes to be composed, it then enters a loop that will ask n times for the parameters (a,b,c,d) which the users provides. Afterwards, the for-loop must call a subroutine, "MatrixDH", which creates a special matrix with the given parameters; the output of this subfunction is A. Finally, the composition takes place: it should multiply the n matrixes created and print the result (Af). Here's what i have written so far:
[codebox]
Clear_a_z
[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]=>Af
Input n
For 1=>i To n
Input a: Input b: Input c: Input d
MatrixDH(a,b,c,d)
Af*A=>Af
Next
PrintNatural Af[/codebox]
I get an "undefined variable" error while running this on my classpad... and i know i also get an error for the step Af*A=>Af
I forgot to mention before, these are supposed to be 4 by 4 matrixes... The program is meant to facilitate computations in the Denavit-Hartenberg direct kinematics expression.
Thanks a LOT for your help!!
#2
Posted 18 February 2010 - 02:06 AM
I've been trying to write a program to do matrix composition in my ClassPad 300.
The program first requests the number (n) of matrixes to be composed, it then enters a loop that will ask n times for the parameters (a,b,c,d) which the users provides. Afterwards, the for-loop must call a subroutine, "MatrixDH", which creates a special matrix with the given parameters; the output of this subfunction is A. Finally, the composition takes place: it should multiply the n matrixes created and print the result (Af). Here's what i have written so far:Clear_a_z[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]=>AfInput n,"",For 1=>i To nInput a: Input b: Input c: Input dMatrixDH(a,b,c,d)Af*A=>AfNextPrintNatural Af
I get an "undefined variable" error while running this on my classpad... and i know i also get an error for the step Af*A=>Af
I forgot to mention before, these are supposed to be 4 by 4 matrixes... The program is meant to facilitate computations in the Denavit-Hartenberg direct kinematics expression.
Thanks a LOT for your help!!
Here the answer to your question
Clear_a_z[[1,0,0,0][0,1,0,0][0,0,1,0][0,0,0,1]]=>fInput n,"N","Input"fill(0,n,1)=>aFor 1=>i To n:Input a[i,1],"Value","Input"Nextf*a=>cPrintNatural c,"Solution"
n=4
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users