keeping equations in different formats

조회 수: 3 (최근 30일)
Gil maor
Gil maor 2017년 8월 1일
답변: Gil maor 2017년 8월 3일
Hello All.
I have a problem. In my project I have three equations which in times I use with symbolic analysis and some times with numerical values. The problem is that I cannot keep the equations as syms due to the following reasons:
1. I need to always change update the syms in different parts of the code and functions 2. Using subs or eval commands take a lot of time mainly when I use loops to change the values.
Is there a way that I could have the equations saved and call them at symbolic form or numerical form and change the variables without using subs/eval?
Thanks!
Gil,
  댓글 수: 8
Karan Gill
Karan Gill 2017년 8월 2일
Of course, that won't work if your numeric values keep changing. You'll have to use subs. Can you provide an example where subs is too slow?
Gil maor
Gil maor 2017년 8월 3일
Hi Karan, Thanks for your reply.
As for the slowness of subs, this was my doing, I have forgotten to place 'double' in front of the 'subs' so the result was an array of sym...
For advice regrading save , load for the equation object!
Thanks!
Gil,

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

채택된 답변

Gil maor
Gil maor 2017년 8월 3일
Thanks All.
Problems solved using sym('avr') when ever calling on the equatiobs
Thanks ALL!!

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 8월 3일
I suggest that you could keep a struct, one field of which is the symbolic form, and another is the result of calling matlabFunction to transform the symbolic form to a function handle for numeric work.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by