필터 지우기
필터 지우기

How to use subs with sym

조회 수: 2 (최근 30일)
hadi
hadi 2015년 3월 17일
댓글: hadi 2015년 3월 17일
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.

채택된 답변

Mischa Kim
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
  댓글 수: 1
hadi
hadi 2015년 3월 17일
Thank you so much I really appreciate your help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by