Simulink element wise multiplication for big data

2 visualizaciones (últimos 30 días)
Vick
Vick el 13 de Oct. de 2018
Comentada: dpb el 15 de Oct. de 2018
Hi all,
I'm new to simulink. In matlab i run a function which takes 100000*10 size of data and gives an output of 100000*1 within 2 sec as the function is taking element wise multiplication(.*) instead of running in a for-loop row by row. I want to implement this function in simulink to take the advantage of blocks(to edit the formula easier in later stages). I've created my model but when i try to run the simulation, my laptop freezes(may be because of out of memory). How to perform element wise multiplication instead of time based simulation? Is simulink only for time based simulation? Sample program,
data=rand(100000,10);
map.BP_x=[1,2,3,4,5,6];map.BP_y=[1,2,3,4,5,6];map.data=rand(6,6);
function output=my_fun(data,map)
interpolation_data=interp2(map.BP_x,map.BP_y,map.data);
output=interpolation_data*data(:,1)+data(:,2)+data(:,3)+data(:,4)+data(:,5)+...;
end
  5 comentarios
Vick
Vick el 15 de Oct. de 2018
Omg again the mistake Actually that is a dot product, output=interpolation_data.*data(:,1)+data(:,2)+data(:,3)+data(:,4)+data(:,5)+data(:,6)+data(:,7)+data(:,8); end
If you see the output that will be of size 100000*1.
What I excctly want is that if I put the same function model in simulink using sum,lookup table, product blocks, simulink will process the data like for 1 sec. So it is kind of running in a for loop. I need a process that simulink takes a whole row of data at one shot and does .* Which will save processing time.
dpb
dpb el 15 de Oct. de 2018
output=interpolation_data.*data(:,1)+sum(data(:,2:8),2);
I've never even seen a Simulink installation so I've zero knowledge about how it actually operates.
I thought a S-function would operate to compute its result with the current inputs at each timestep evolution???
If that's not so, I have nothing I can add, sorry.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by