Got Questions? Get Answers.
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:
What this matrix mean

Subject: What this matrix mean

From: Bestun

Date: 11 Aug, 2012 18:02:07

Message: 1 of 5

Dear all
This is a section of my code that I am using:
***********************************************
function [objP, padN, N] = plasticMultiplierTerms(nodes, discs, c, phiDegrees,rw, a, Yw, rd, rsat);
    global flag;
objP = sparse(0, 0); padN = sparse(0, 0); N = sparse(0, 0); count = 1; tan_phi = tan(pi * phiDegrees / 180);
for i = 1 : size(discs, 1);
    if (discs(i, 3) < 2) % i.e. if rigid or symmetry
        [eff_c eff_tanPhi] = deal(c * (discs(i, 3) ~= 1), tan_phi * (discs(i, 3) ~= 1));
        [n1 n2 len] = deal(discs(i, 1), discs(i, 2), discs(i, 4));
        Tensile = unsatCohesion(nodes(n1,2), nodes(n1, 3), nodes(n2,2), nodes(n2, 3), tan_phi, len, rw, a, Yw, rd, rsat);
        Ts = Tensile/len;
        [con var] = deal(2 * count - 1, 2 * count - 1);
        N_local = [1 -1 1 -1; eff_tanPhi eff_tanPhi 1000 1000];
        [N_local]
        N([con con + 1], [var var + 1 1 2]) = N_local;
            N([con con + 1], [var var + 1 10 10])
        padN_local = sparse(2, 2 * size(discs, 1)); %All zero sparse: 2-by-12
           [padN_local];
        padN_local(1, 2 * i - 1) = -1;
        padN_local(2, 2 * i) = -1;
        padN = [padN; padN_local];
          [padN];
        objP = [objP eff_c * discs(i, 4) Ts*discs(i, 4) 0 0 eff_c * discs(i, 4) Ts*discs(i, 4) 0 0 ];
           [objP];
          count = count + 1;
        end
end
***********************************
I have this( N([con con + 1], [var var + 1 1 2])) matrix and I want to equalize it to N_local matrix
 N([con con + 1], [var var + 1 1 2]) = N_local;
but for the above term they are not equal. I tried to change :
N([con con + 1], [var var + 1 1 2]) to N([con con + 1], [var var + 1 2 3) , but also I got different answer comparing to N_local

could any one help me how to do this and what this term mean N([con con + 1], [var var + 1 1 2]) ?





Regards
Bestun

Subject: What this matrix mean

From: dpb

Date: 11 Aug, 2012 18:22:21

Message: 2 of 5

On 8/11/2012 1:02 PM, Bestun wrote:
...

> ... what this term mean N([con con + 1], [var var + 1 1 2]) ?

Use debug and set breakpoint at that line so variables are in context
and explore the expressions

[con con + 1]
[var var + 1 1 2]

to see what they result in. Then it should all become clear as to what

N(those_expressions) is. Knowing that will probably allow you to solve
your other problems I'd expect.

--

Subject: What this matrix mean

From: Bestun

Date: 11 Aug, 2012 18:34:07

Message: 3 of 5

dpb <none@non.net> wrote in message <k067sr$ioc$1@speranza.aioe.org>...
> On 8/11/2012 1:02 PM, Bestun wrote:
> ...
>
> > ... what this term mean N([con con + 1], [var var + 1 1 2]) ?
>
> Use debug and set breakpoint at that line so variables are in context
> and explore the expressions
>
> [con con + 1]
> [var var + 1 1 2]
>
> to see what they result in. Then it should all become clear as to what
>
> N(those_expressions) is. Knowing that will probably allow you to solve
> your other problems I'd expect.
>
> --Thanks for your reply
I did debug but I couldn't understand what N matrix mean N([con con + 1], [var var + 1 1 2]) ?
Although I changed [var var + 1 1 2]) to [var var + 1 1 3]) ,[var var + 1 1 4]) , [var var + 1 2 3]) and [var var + 1 2 4]), but every time gave different answer (not equal to N_local)
The mean work is with [var var + 1 1 2])..I mean who to change this matrix to be equal to N_local

Subject: What this matrix mean

From: Bruno Luong

Date: 11 Aug, 2012 20:52:06

Message: 4 of 5

"Bestun " <bestun@xxxxxx.com> wrote in message <k068iv$77f$1@newscl01ah.mathworks.com>...

> I did debug but I couldn't understand what N matrix mean N([con con + 1], [var var + 1 1 2]) ?

Don't bother, this piece of code is wrongly indented to start with.

Bruno

Subject: What this matrix mean

From: dpb

Date: 11 Aug, 2012 21:19:38

Message: 5 of 5

On 8/11/2012 1:34 PM, Bestun wrote:
> dpb <none@non.net> wrote in message <k067sr$ioc$1@speranza.aioe.org>...
>> On 8/11/2012 1:02 PM, Bestun wrote:
>> ...
>>
>> > ... what this term mean N([con con + 1], [var var + 1 1 2]) ?
>>
>> Use debug and set breakpoint at that line so variables are in context
>> and explore the expressions
>>
>> [con con + 1]
>> [var var + 1 1 2]
>>
>> to see what they result in. Then it should all become clear as to what
>>
>> N(those_expressions) is. Knowing that will probably allow you to solve
>> your other problems I'd expect.
>>
>> --Thanks for your reply
> I did debug but I couldn't understand what N matrix...

Ponder the following...

 >> dat=reshape([1:9],3,3)
dat =
      1 4 7
      2 5 8
      3 6 9
 >> dat([1 2 3], [3 2 1])
ans =
      7 4 1
      8 5 2
      9 6 3
 >>

--

Tags for 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