Consider the arbitrary function:
function myFunc_ = myFunc(firstInput, secondInput)
myFunc_ = firstInput * secondInput;
end
Now imagine I want to map the above function to an array for the first input firstInput, while the second input secondInput is constant. For example, something like:
firstVariable = linspace(0., 1.);
plot(firstVariable, map(myFunc, [firstVariable , 0.1]))
where 0.1 is an arbitrary scalar value for the secondInput and firstVariable array is an arbitrary array for the firstInput.
I have looked into the arrayfun() function. However, I don't know how to include the constant variable. Plus it seems like the syntax between MATLAB and Octave are different, or maybe I'm mistaken. It is important for me to have a cross-compatible code that I can share with colleagues.
map(fun, argv), but wouldn'tplot(firstVariable, myFunc(firstVariable, 0.1))suffice?myFunc(firstVariable, 0.1))returns a scalar in Octave. I don't know what it does on MATLAB though!myFunc(firstVariable, 0.1)returns a vector in MATLAB!! What happens if you substitute an elementwise.*for the*in your function definition, does that make any difference? (octave.org/doc/v6.2.0/Broadcasting.html)