Add "." to simple operators such as +, *, /, ^ in order to calculate element by element values

1 次查看(过去 30 天)
Hi
I have an expression, say " 5A/B+C*D ". This equations came automatically in my script in Matlab. Thereafter, I need to evaluate this equation in different sets of (A,B,C,D). So, I need to change it to "5A./B+C.*D". How can I do that automatically in Matlab in through some lines? I do not want to do add "." by hand.
Your is really appreciated.
  1 个评论
Image Analyst
Image Analyst 2016-7-15
Why not? As you code, you'll be hitting keys on your keyboard thousands of times, so what's wrong with hitting "." a few times? And what do you mean those equations came automatically? Someone typed them in at some point in time, didn't they? Who gave you the script? Ask them why they didn't type it in correctly.

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2016-7-15
Use the vectorize function.
  4 个评论
Hossein
Hossein 2016-7-15
Previously you helped me how to solve multiple nonlinear complex equations using fsolve, fzero, and so on. Thanks again

请先登录,再进行评论。

更多回答(0 个)

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by