| New Reply |
Matrix problem in matlab |
Share Thread | Thread Tools |
| Oct29-12, 07:51 PM | #1 |
|
|
Matrix problem in matlab
i have 2 simple matlab questions
first when i have two matrices the first one is empty and the second one conatins numbers i can Say A=B SO THE VALUE OF B BECOMES INSIDE A BUT MY QUESTION I JUST DEFINE SYMS EI and multiply it by B bUT When itry to put Put B in A IT DOENST WORK COULD ANY ONE HELP PLEASE THE SECOND QUESTION , WHEN i make transpose for matrix it gives me conject, so how can i deal with this thank |
| Oct29-12, 08:24 PM | #2 |
|
Mentor
|
Also, this should be posted in the section that deals with Matlab and Mathematica, etc. I am moving your post to that section, but will leave a forwarding link. |
| Oct30-12, 03:56 AM | #3 |
|
|
Please post your code.
|
| Oct30-12, 08:41 PM | #4 |
|
|
Matrix problem in matlab
FIRST QUESTION
clc clear all T=0*pi/180; A12=[(cos(T))^2 cos(T)*sin(T) -(cos(T))^2 -cos(T)*sin(T); cos(T)*sin(T) (sin(T))^2 -cos(T)*sin(T) -(sin(T))^2;-(cos(T))^2 -cos(T)*sin(T) (cos(T))^2 cos(T)*sin(T);-cos(T)*sin(T) -(sin(T))^2 cos(T)*sin(T) (sin(T))^2] T=0*pi/180; A43=[(cos(T))^2 cos(T)*sin(T) -(cos(T))^2 -cos(T)*sin(T); cos(T)*sin(T) (sin(T))^2 -cos(T)*sin(T) -(sin(T))^2;-(cos(T))^2 -cos(T)*sin(T) (cos(T))^2 cos(T)*sin(T);-cos(T)*sin(T) -(sin(T))^2 cos(T)*sin(T) (sin(T))^2] T=90*pi/180; A14=[(cos(T))^2 cos(T)*sin(T) -(cos(T))^2 -cos(T)*sin(T); cos(T)*sin(T) (sin(T))^2 -cos(T)*sin(T) -(sin(T))^2;-(cos(T))^2 -cos(T)*sin(T) (cos(T))^2 cos(T)*sin(T);-cos(T)*sin(T) -(sin(T))^2 cos(T)*sin(T) (sin(T))^2] T=90*pi/180; A23=[(cos(T))^2 cos(T)*sin(T) -(cos(T))^2 -cos(T)*sin(T); cos(T)*sin(T) (sin(T))^2 -cos(T)*sin(T) -(sin(T))^2;-(cos(T))^2 -cos(T)*sin(T) (cos(T))^2 cos(T)*sin(T);-cos(T)*sin(T) -(sin(T))^2 cos(T)*sin(T) (sin(T))^2] T=53.13*pi/180; A13=[(cos(T))^2 cos(T)*sin(T) -(cos(T))^2 -cos(T)*sin(T); cos(T)*sin(T) (sin(T))^2 -cos(T)*sin(T) -(sin(T))^2;-(cos(T))^2 -cos(T)*sin(T) (cos(T))^2 cos(T)*sin(T);-cos(T)*sin(T) -(sin(T))^2 cos(T)*sin(T) (sin(T))^2] A=[zeros(8,8)] syms EI A12=EI.*A12./3 A43=EI.*A43./3 A14=EI.*A14./4 A23=EI.*A23./4 A13=EI.*A13./5 c=1 s=0 for i=[1 2 3 4] for j=[1 2 3 4] s=s+1 A(i,j)=A12(c,s) end c=c+1 s=0 end c=1 s=0 for i=[1 2 7 8] for j=[1 2 7 8] s=s+1 A(i,j)= A(i,j)+A14(c,s) end c=c+1 s=0 end c=1 s=0 for i=[7 8 5 6] for j=[7 8 5 6] s=s+1 A(i,j)= A(i,j)+A43(c,s) end c=c+1 s=0 end c=1 s=0 for i=[3 4 5 6] for j=[3 4 5 6] s=s+1 A(i,j)= A(i,j)+A23(c,s) end c=c+1 s=0 end c=1 s=0 for i=[1 2 5 6] for j=[1 2 5 6] s=s+1 A(i,j)= A(i,j)+A13(c,s) end c=c+1 s=0 end b=A(2:6,2:6) b=inv(b) c=[0; 0; 0; 15; -20] d=b*c |
| Oct30-12, 08:41 PM | #5 |
|
|
This one works without ei????i dont know why
|
| Oct30-12, 08:42 PM | #6 |
|
|
this is second question
clc clear all syms L x W w1 %% W=w2-w1 A=[ 1 0 0 0;0 -1 0 0;-3/L^2 2/L 3/L^2 1/L; 2/L^3 -1/L^2 -2/L^3 -1/L^2] B=A' C=[1;x;x^2;x^3] D=w1+W*x/L F=C*D E=int(F,x,0,L) M=B*E |
| Oct31-12, 10:38 AM | #7 |
|
|
|
| Oct31-12, 11:50 AM | #8 |
|
Recognitions:
|
Just to be clear SADEQ, is this the specific code that fails? When you try to assign the symbolic variable to the previously defined numeric variable A12? |
| Oct31-12, 01:10 PM | #9 |
|
|
Syms EI as any variable ,YOU CAN SAY X instead or anything
thr problem become when i use it in Matrix A |
| Oct31-12, 01:13 PM | #10 |
|
|
the system will fail when i try to fill A12 in A for example
however A12 has been defined(already multipled by Varaible X, EI whatever) |
| Oct31-12, 01:56 PM | #11 |
|
|
What do you expect to see? What do you see (including any error messages)? |
| Nov1-12, 11:31 AM | #12 |
|
Recognitions:
|
Code:
A=[zeros(8,8)] syms EI A12=EI.*A12./3 But it draws the line at this. That is, when you attempt to redefine a single entry in a (previously) numeric matrix as a symbolic (while the other entries in the matrix remain, at this time, numeric). This behavior is not all that surprising to be honest. Code:
A(i,j)=A12(c,s) |
| Nov2-12, 12:09 AM | #13 |
|
|
so can i define empty matrix , allowing me to enter symbolic?if yes how?
Thank you man |
| Nov2-12, 07:51 AM | #14 |
|
Recognitions:
|
For example, I think this should work. Code:
A = zeros(8,8) A = sym(A) |
| New Reply |
| Thread Tools | |
Similar Threads for: Matrix problem in matlab
|
||||
| Thread | Forum | Replies | ||
| Matrix help in MatLab, Not the simple matrix!! I have searched, found nothing! | Math & Science Software | 3 | ||
| Matlab max and min of a matrix | General Math | 1 | ||
| MatLab Matrix Help | Math & Science Software | 0 | ||
| matrix in matlab | Calculus & Beyond Homework | 0 | ||
| Matrix problem in MATLAB | Math & Science Software | 8 | ||