How can i use two seperate functions to give one output?

조회 수: 4 (최근 30일)
Hoda
Hoda 2025년 3월 31일
답변: Star Strider 2025년 3월 31일
Hi, I have one equation that is to be broken up in to two seperate functions. How do i bring these two seperate functions together in the workspace to give one output?

답변 (1개)

Star Strider
Star Strider 2025년 3월 31일
That depends on what the function arguments are, and what ‘one output’ is.
A bit more detail would help significantly!
Example —
Equation: y = exp(x) .* sin(x)
functions:
f1 = @(x) exp(x);
f2 = @(x) sin(x);
Combine results:
ft = @(x) f1(x) + f2(s) % Addition
ft = @(x) f1(x) .* f2(x) % Element-Wise Multiplication
ft = @(x) [f1(x); f2(x)] % Array
.

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by