I have one file with the following code:
function fx=ff(x)
fx=x;
I have another file with the following code:
function g = Lapl
Looks like what you're trying to do is create a function in the variable g
. That is, you want the first line to mean,
"Let
g(x)
be a function that is calculated like this:ff(x)*exp(-s*x)
",
rather than
"calculate the value of
ff(x)*exp(-s*x)
and put the result ing
".
You can create a subfunction for this
function result = g(x)
result = ff(x) * exp(-s * x);
end
Or you can create an anonymous function
g = @(x) ff(x) * exp(-s * x);
Then you can use g(a)
, g(b)
, etc to calculate what you want.