I have an array called contin array like [10,100,1000], and I'd like to apply a function called transcontin to that array. I know that the way to do this is arrayfunc(@transcontin, contin), if there is only one input to the function.
But, the function transcontin takes three inputs: Temp, b, and H. And, I need it to pass the values of the array into the function transcontin as b.
But, I have to loop through values of Temp and H. These values of Temp and H stay the same throughout each application to contin.
How do I accomplish this? How do I do arrayfunc(@transcontin, contin) but pass in the other two parameters that do not come in as an array?
Example input: contin=[10, 100, 1000]
Function:
function result=transcontin(Temp,b,h)
result=b+Temp^h;
end
Let's say I want to fix Temp and h, and pass the elements of the array in as b:
Temp=5;
h=(1/3);
The output, after I do something like this upon the suggestion from @Edric arrayfun(@b transcontin(Temp, b, h), contin), should be a vector transformed into:
[10+5^(1/3), 100+5^(1/3), 1000+5^(1/3)]
how to accomplish this?
arrayfunneed array as input. You can userepmatin order to clone your parameters. Something like:arrayfun(@thefunction,contin,repmat(b,1000,1)if you have 1000 loops. - obchardon