필터 지우기
필터 지우기

How to find f(x)*g(x)

조회 수: 4 (최근 30일)
Tran
Tran 2015년 3월 25일
댓글: John D'Errico 2021년 4월 6일
Hi!
If i have f(x) = 1 + x and g(x) = 1 - x, i want to find h(x) = f(x)*g(x) = (1+x)*(1-x)=1-x.^2 What should i do?
Thanks!

답변 (2개)

Star Strider
Star Strider 2015년 3월 25일
It looks like you already did it. To code it using anonymous functions:
f = @(x) 1 + x;
g = @(x) 1 - x;
h = @(x) f(x).*g(x);
x = linspace(-10, 10);
figure(1)
plot(x, f(x), x, g(x), x, h(x))
grid
legend('f(x)', 'g(x)', 'h(x)', 'Location', 'south')
  댓글 수: 11
Tran
Tran 2015년 3월 25일
Thank you so much James Tursa!
Star Strider
Star Strider 2015년 3월 25일
@James — Thank you!
@Tran — My pleasure!

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


Tanveer ul haq
Tanveer ul haq 2021년 4월 6일
syms x
f = 1 + x;
g = 1 - x;
h = simplify(f*g)
  댓글 수: 1
John D'Errico
John D'Errico 2021년 4월 6일
Note that this does not actually solve the problem as asked.

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

카테고리

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