Elementwise multiplication of two matrices which does not contain NaN elements Results a matrix with lots of Nan Values

4 次查看(过去 30 天)
Hi,
I have a matrix multiplication. First matrix is input_of_hidden_layer2 second matrix is error_of_hidden_layer2.
Before multiplication I check the number of NAn values in the matrixes as below:
result1 = sum(isnan(input_of_hidden_layer2(:)));
result2 = sum(isnan(error_of_hidden_layer2(:)));
disp("result1 " + result1);
disp("result2 " + result2);
I also print the matrix values.
This is the multiplication
delta2 = vpa(((input_of_hidden_layer2>0).*error_of_hidden_layer2),150);
The resulting matrix delta2 is a (30,1) matrix and contains 14 NaN values. There is no Inf value, there is no division. I think this is nonsense. Please help me to understand and fix this problem.
I attached the matrix values in a separate file for you to check.
Best Regards,
Ferda
  4 个评论

请先登录,再进行评论。

采纳的回答

ferda sonmez
ferda sonmez 2019-3-31
Hi,
The problem was the matrixes didn't store double values but they were symbolic for some reason. The problem was not related to elementwise multiplication. I casted all the matrixes to double prior to this operation.
Best Regards,
Ferda Özdemir Sönmez

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by