Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,i want to simulate a system physical in simulink matlab rs2015.
i read from website mathworks
cross product
i.e. using this:
C#
t1 = [2,3,1];
 t2 = [3,1,2];
 C = A(:,t1).*B(:,t2)-A(:,t2).*B(:,t1);

please see image simulink:
please see image

fcn function is defined:
function C = fcn(A,  B)
 t1 = [2,3,1];
 t2 = [3,1,2];
C = A(:,t1).*B(:,t2)-A(:,t2).*B(:,t1);

now wehn i run it:it returns this errors:
 Attempted to access index 2 of data A.

MATLAB function eML_blk_kernel in MATLAB Function MATLAB Function: C = A(:,t1).*B(:,t2)-A(:,t2).*B(:,t1);
                                                                           ^^

The valid index range is 1 to 1.

This error will stop the simulation.
Component: MATLAB Function | Category: Runtime error

An error occurred while running the simulation and the simulation was terminated

Simulation stopped because of a runtime error: out of bounds.
Component: Simulink | Category: Block error

how we can defined a function that is can operate with vector concatenate

thanks for attention

What I have tried:

i tested but not idea for doing it.....
Posted
Updated 24-Mar-16 6:01am
v2

1 solution

solution that i found i created vector and i used mux and demux for create separating signals.i created fcn and inputs signal,now with fcn and mux and demux finally i created cross product function.

thanks for attention
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900