필터 지우기
필터 지우기

Hou to substitute a variable

조회 수: 1 (최근 30일)
Nadia Bica
Nadia Bica 2015년 4월 24일
답변: Star Strider 2015년 4월 24일
Hello on the file that is attached I want to substitute a variable called My by the result of momento so then all the operations where My is used start to use the output of momento. I tried subs(My,momento) but it didnt work. All the operations still have My. Thank you.
  댓글 수: 2
Mischa Kim
Mischa Kim 2015년 4월 24일
There is no file attached.
Stephen23
Stephen23 2015년 4월 24일
@ Nadia Bica: to upload a file you need to click the paperclip button, and then push both buttons: Choose file and Attach file.

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

답변 (1개)

Star Strider
Star Strider 2015년 4월 24일
The subs function needs three arguments. You have to tell subs the expression you want to substitute your variables in. That is the part you did not state in your subs call.
For example (assuming that you want to substitute ‘momento’ for ‘My’ in a function I call ‘F’ here):
syms x y My
F = x + y + My;
momento = x*y;
F = subs(F, My, momento)
produces:
F =
x + y + x*y

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by