Discrepancies solving the same function (in Matlab and in Simulink)
显示 更早的评论
Hello everybody,
since a few weeks I am facing up with a problem of solving function in Simulink (using Matlab Function Block). In brief I get different results solving the same function in Simulink and in Matlab. I tried to modify all solver options and I tried to use also extrinsic function, to run the function from .m-file.
I have figured out, that the problem is in calculating the beta angle:
beta_3_v = -log(-((dY + dZ*1i)*(2*((2*UOst_y*(UOst_y^2 - dY^2 - dZ^2)^(3/2) + 2*UOst_y^4 + dY^4 + dZ^4 + 2*UOst_x^2*UOst_y^2 - 2*UOst_y^2*dX^2 - UOst_x^2*dY^2 - 3*UOst_y^2*dY^2 - UOst_x^2*dZ^2 - 3*UOst_y^2*dZ^2 + dX^2*dY^2 + dX^2*dZ^2 + 2*dY^2*dZ^2 + 2*UOst_x^2*UOst_y*(UOst_y^2 - dY^2 - dZ^2)^(1/2) - 2*UOst_y*dX^2*(UOst_y^2 - dY^2 - dZ^2)^(1/2))/(dY + dZ*1i)^2)^(1/2) - (2*UOst_x*(UOst_y + (UOst_y^2 - dY^2 - dZ^2)^(1/2)))/(dY + dZ*1i)))/(2*(UOst_y*dX - UOst_y*(UOst_y^2 - dY^2 - dZ^2)^(1/2) + dX*(UOst_y^2 - dY^2 - dZ^2)^(1/2) - UOst_y^2 + dY^2 + dZ^2)))*1i
Simulink solve this equation sometimes correct, sometimes wrong (I did not discover any factor, which has influence on the solving, beyond frequency of the input signal - the higher the frequency, the more miscalculations). As mention before, when I use the same input date solving the function in Matlab I get correct result. In the attachment I am sending function.
Any suggestions ?
Thank you in advance for your help
1 个评论
Udit06
2023-9-29
Hi Mateusz,
I understand that you are getting different results solving the same function in MATLAB and Simulink. When I tried to reproduce the issue at my end, I did not face any such discrepancy in the results. If you are still facing the discrepancy, it would be helpful if you could share the input signal and the model configuration parameters that you have used for simulation.
Thanks
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!