How to perform element-wise matrix multiplication in simulink?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have modelled the equations below in Simulink and I wanted to check them through simulation. But when modelled in Simulink they give an error.
s_x_index = 0:0.0001:0.02;
for i = 1:length(s_x_index)
x_a(i) = s_x_index(i);
epsilon_x=1/4.*[(G.*pi.*a1.*b1.*c_11.*s_x_index)/(Q.*cof)];
F=(2*Q*cof/pi).*[(k_A*epsilon_x)./(1+(k_A*epsilon_x).^2)+atan(k_S*epsilon_x)];
I have posted only few lines of the code and not the entire coding thinking that this is enough to explain, please let me know if you need further information.
Please find attached the block in the model which cause the error. The error is,
Error using test_file (line 429) Error evaluating parameter 'Value' in 'force/Constant7'
Caused by: Error using test_file (line 429) Inner matrix dimensions must agree.
The size of the parameters are given below,
>> size(a1)
ans =
1 1
>> size(b1)
ans =
1 1
>> size(G)
ans =
1 1
>> size(c_11)
ans =
1 1
>> size(s_x_index)
ans =
1 201
Please do help out.
Thanks.
0 comentarios
Respuestas (1)
Oyeniyi
el 8 de Sept. de 2014
Perhaps you want to ensure element-wise multiplication and division. The 2nd division in 'epsilon_x' is the matrix type. As you haven't given the size of the other parameters (Q, cof etc), one cannot know for sure the intended type of operation. Try
epsilon_x=1/4.*[(G.*pi.*a1.*b1.*c_11.*s_x_index)./(Q.*cof)]; F=(2*Q.*cof/pi).*[(k_A.*epsilon_x)./(1+(k_A.*epsilon_x).^2)+atan(k_S.*epsilon_x)];
1 comentario
Ver también
Categorías
Más información sobre General Applications en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!