How to use symbolic expression with matlab coder
이전 댓글 표시
I have a symbolic expression that I would like to integrate using a mex file. I know how to do the integration the following way:
function f=test_fun(x)
f=x.^2;
end
^This is the function I am integrating
function q=test_int(a,b)
q=quadgk(@test_fun,a,b);
end
^This is the call to integrate that function:
Using this I can successfully create a mex file.
My problem is that in my test_fun file, I would like to use a symbolic expression that I have loaded with load('') for f rather than explicitly typing the equation because it is way to long to type. I would like to do something like this if possible.
function f=test_fun(x)
load('f') %f is a symbolic expression of x
f=eval(f);
end
Is there a way to do this??
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Code Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!