How can i use two seperate functions to give one output?
조회 수: 4 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!