How to use subs with sym
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear All,
I have the following code:
clc
clear all
close all
f=@(x,y)x^2+y;
f=sym(f);
out=subs(f,x,2)
Could you please tell me what should I do to prevent getting an error.
Thanks a lot.
댓글 수: 0
채택된 답변
Mischa Kim
2015년 3월 17일
hadi, you need to define x as a symbolic variable
syms x y
f = @(x,y) x^2 + y;
f = sym(f);
out = subs(f,x,2)
out =
y + 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!