Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
hi anyone has idea...

Subject: hi anyone has idea...

From: chet

Date: 7 Jun, 2011 17:00:19

Message: 1 of 3

I have posted the codes here ...... the proble is that in the for loop where I have been calculating A matrix then inverse of that matrix i.e, a matrix,I have problem saying "Warning: Matrix is singular to working precision. " I used pinv syntax but I dont get the required values of inverse of matrix A.
could anyone tell me wat is wrong with the procedures .. I have posted here my coding form top to bottom
thnx
A=zeros(3,3);
for i = 1:3
    for j = 1:3
  
        
        A(i,j)= Qbar1(i,j)*h +Qbar2(i,j)*h +Qbar3(i,j)*h +Qbar4(i,j)*h ; % calc of A matrix
        A_1(i,j) = Qbar1(i,j)*h ; %A matrix for 0 degree
        A_2(i,j)= Qbar2(i,j)*h ; %A matrix for 45 degree
        A_3(i,j)= Qbar3(i,j)*h; %A matrix for 90 degree
        A_4(i,j)= Qbar4(i,j)*h ; %A matrix for -45 degree
        
    end
end
 a=zeros(3,3) ;
for i = 1:3
    for j = 1:3
        a(i,j)=inv(A(i,j));
        a_1(i,j)=inv(A_1(i,j)); % calc of a matrix the inverse of A matrix... %Warning: Matrix is singular to working precision.
        a_2(i,j)=inv(A_2(i,j));
        a_3(i,j)=inv(A_3(i,j));
        a_4(i,j)=inv(A_4(i,j));
        lambda1= sqrt((a_1(1,1)+ a_2(1,1))*G)/H; % calculation of lambda.
        lambda2= sqrt((a_2(1,1)+ a_3(1,1))*G)/H;
        lambda3= sqrt((a_3(1,1)+ a_4(1,1))*G)/H;
        
        a_star1= (a_2(1,1)+ a_2(1,1))/(a_1(1,1)+a_1(1,1)); % calc of a star for kth lamina
        a_star2= (a_3(1,1)+ a_3(1,1))/(a_2(1,1)+a_2(1,1));
        
        p_star1= P/H*(((a_2(1,1)*a_2(1,1))-(a_3(1,1)*a_1(1,1)))/(a_1(1,1)*a_2(1,1))); % calc of p star for kth lamina
        p_star2= P/H*(((a_3(1,1)*a_3(1,1))-(a_4(1,1)*a_2(1,1)))/(a_2(1,1)*a_3(1,1)));
        
       
    end
end

Subject: hi anyone has idea...

From: dpb

Date: 7 Jun, 2011 17:11:30

Message: 2 of 3

On 6/7/2011 12:00 PM, chet wrote:
> I have posted the codes here ...... the proble is that in the for loop
> where I have been calculating A matrix then inverse of that matrix i.e,
> a matrix,I have problem saying "Warning: Matrix is singular to working
> precision. " I used pinv syntax but I dont get the required values of
> inverse of matrix A. could anyone tell me wat is wrong with the
> procedures .. I have posted here my coding form top to bottom thnx
> A=zeros(3,3);
> for i = 1:3
> for j = 1:3

It isn't the problem here, but 'i' and 'j' are the imaginary sqrt(-1) in
Matlab. Overriding them is, in general, a practice to be avoided.

> A(i,j)= Qbar1(i,j)*h +Qbar2(i,j)*h +Qbar3(i,j)*h +Qbar4(i,j)*h ;

......

> for j = 1:3
> a(i,j)=inv(A(i,j));

Surely this isn't what you intend??? A(i,j) is a single element so, say
A(1,1) = 3; inv(A(1,1)) = 0.333...

> a_1(i,j)=inv(A_1(i,j)); % calc of a matrix the inverse of A matrix...
> %Warning: Matrix is singular to working precision.

Same comment.

Try inv(0) from the command line and I think you'll realize the problem

--

Subject: hi anyone has idea...

From: Husam Aldahiyat

Date: 7 Jun, 2011 20:58:04

Message: 3 of 3

You need to learn how to use CELL matrices.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us