How to run equation only in one script as a function by strategically locating "syms x'? (Note: Except using @x)
1 view (last 30 days)
Ashutosh Singh Baghel on 22 Dec 2021
Edited: Ashutosh Singh Baghel on 22 Dec 2021
I understand you wish to implement an equation inside a function defined in the same script calling it. This issue is resolved by adding two numbers, as shown in the following example.
a = 2;
b = 4;
[sum_0,sum_1] = sumEquation(a,b)
function [OUT1,OUT2] = sumEquation(x_in,y_in)
f(x,y) = x + y;
OUT1 = f(x_in,y_in);
OUT2 = summation(x_in,y_in);
function out = summation(x1,y1)
g(x,y) = x+y;
out = g(x1,y1);
For more information, visit MATLAB Documentation page on 'syms'.