function r = fun(x, params, type)
h = @(x) x(1)-x(8);
x= sym('x',[1,8]);
gamma = 16;
if type == 'linear'
r = gamma*h(x);
elseif type == 'sin'
r = gamma*sin(h(x));
end
end
When I run this function for type 'sin' I always get this error
Arrays have incompatible sizes for this operation.
Error in fun (line 7)
if type == 'linear'
How to fix this?
I just one to pass type and depending on that create my ouput, I though string could be okay, but it doesn't work.
I want to multiply my function handle with gamma in case of linear and multiply and take sin in case of sine.