For Programmers: Free Programming Magazines  


Home > Archive > Matlab > July 2006 > Problem using connect & append









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem using connect & append
Tim

2006-07-31, 7:17 pm

Refering to this block diagram :
<http://i78.photobucket.com/albums/j...ang3/model2.jpg>

I am still practising on Matlab, and this is my code:

C1 = tf(1,[1 1])
C2 = tf(1,[1 1])
C3 = tf(1,[1 1])
C4 = tf(1,[1 1])

csim = append(C1,C2,C3,C4);

%% Once appended the system is

%% (i1) C1 (o1) C1
%% (i2) C2 (o2) C2
%% (i3) C3 (o3) C3
%% (i4) C4 (o4) C4
%% (i5) input1 (o5) SumPoint1
%% (i6) input2 (o6) SumPoint2

connect_matrix = [5 1 3; %Summing Point 1 = C1 + C3
6 2 4; %Summing Point 2 = C2 + C4
4 5 0; %C4 to input1
3 6 0; %C3 to input2
1 5 0; %C1 to input1
2 6 0]; %C2 to input2

input_matrix = [5 %input1
6]; %input2

output_matrix = [5 %SumPoint1
6];%SumPoint2

controller=connect(csimss,connect_matrix
,input_matrix,output_matrix);

--------------------------------------------
Error I received:

Error in ==> lti.connect at 71
bb = b/(eye(nd) - k*d);

Error in ==> gui_model>gui_model_OpeningFcn at 351
controller =
connect(csimss,connect_matrix,input_matr
ix,output_matrix);

I do not understand which part went wrong...
Tim

2006-07-31, 7:17 pm

Pardon me for a typo. The second last line should be
connect(csim,connect_matrix,input_matrix
,output_matrix);

....with the csimss being replaced by csim
Pascal Gahinet

2006-07-31, 10:02 pm

Hi Tim

The problem here is that you refer to inputs 5 and 6 in connect_matrix, but
your model CSIM only has 4 inputs and 4 outputs. You need to include the
summing junctions in CSIM.

If you have a recent version of the Control System Toolbox, I recommend
using the "named-based interconnection" feature in CONNECT (type HELP
CONNECT for details). This should make your job much easier...

Best wishes
- pascal

"Tim" <t_ang3@yahoo.com> wrote in message
news:ef3d066.-1@webcrossing.raydaftYaTP...
> Refering to this block diagram :
> <http://i78.photobucket.com/albums/j...ang3/model2.jpg>
>
> I am still practising on Matlab, and this is my code:
>
> C1 = tf(1,[1 1])
> C2 = tf(1,[1 1])
> C3 = tf(1,[1 1])
> C4 = tf(1,[1 1])
>
> csim = append(C1,C2,C3,C4);
>
> %% Once appended the system is
>
> %% (i1) C1 (o1) C1
> %% (i2) C2 (o2) C2
> %% (i3) C3 (o3) C3
> %% (i4) C4 (o4) C4
> %% (i5) input1 (o5) SumPoint1
> %% (i6) input2 (o6) SumPoint2
>
> connect_matrix = [5 1 3; %Summing Point 1 = C1 + C3
> 6 2 4; %Summing Point 2 = C2 + C4
> 4 5 0; %C4 to input1
> 3 6 0; %C3 to input2
> 1 5 0; %C1 to input1
> 2 6 0]; %C2 to input2
>
> input_matrix = [5 %input1
> 6]; %input2
>
> output_matrix = [5 %SumPoint1
> 6];%SumPoint2
>
> controller=connect(csimss,connect_matrix
,input_matrix,output_matrix);
>
> --------------------------------------------
> Error I received:
>
> Error in ==> lti.connect at 71
> bb = b/(eye(nd) - k*d);
>
> Error in ==> gui_model>gui_model_OpeningFcn at 351
> controller =
> connect(csimss,connect_matrix,input_matr
ix,output_matrix);
>
> I do not understand which part went wrong...



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com