필터 지우기
필터 지우기

How to substitute to a variable in a function with a constant

조회 수: 2 (최근 30일)
ijsonvjksrefdsb
ijsonvjksrefdsb 2022년 9월 6일
편집: Stephen23 2022년 10월 18일
I'm trying to substitute some values of t to this equation:
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
Unrecognized function or variable 't'.
But it won't work because of the c. The assignment is to avoid using symbolic math, how can I bypass this error? Like it would simply substitute the values of t with c remaining undefined. Thanks
  댓글 수: 1
Stephen23
Stephen23 2022년 10월 18일
편집: Stephen23 2022년 10월 18일
Original question retrieved from Google Cache:
How to substitute to a variable in a function with a constant
I'm trying to substitute some values of t to this equation:
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
Unrecognized function or variable 't'.
But it won't work because of the c. The assignment is to avoid using symbolic math, how can I bypass this error? Like it would simply substitute the values of t with c remaining undefined. Thanks

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

답변 (1개)

Chunru
Chunru 2022년 9월 6일
편집: Chunru 2022년 9월 6일
% Specify the values beforehand
t = 0:.1:5;
c = 2;
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
plot(t, x)
% symbolic computation
syms t c x
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3
x = 

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by