Simulink element wise multiplication for big data

1 visualizzazione (ultimi 30 giorni)
Vick
Vick il 13 Ott 2018
Commentato: dpb il 15 Ott 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 Commenti
Vick
Vick il 15 Ott 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 il 15 Ott 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Simulink in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by