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
Star Strider
Star Strider 2016년 7월 15일
As always, my pleasure!
That’s what I’m here for!

댓글을 달려면 로그인하십시오.

추가 답변 (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