MATLAB: How to convert the output of this function to a numeric value. I have used vpa and double function but some or the other expression gets left unsolved.
convertsymbolicSymbolic Math Toolbox
syms b x
y = 20*power(.05,b)*int(power(sin(x),b+1),x,0,18.19);
for i= -1:.1:0
b=i
disp(y)
end
Best Answer
Use subs() to see the substituted values
syms b x
y = 20*power(.05,b)*int(power(sin(x),b+1),x,0,18.19);
for i= -1:.1:0
subs(y, b, i)
end
Or save them in an array
syms b x
y = 20*power(.05,b)*int(power(sin(x),b+1),x,0,18.19);
B = -1:.1:0;
z = zeros(size(B), 'like', b)';
for i = 1:numel(B)
z(i) = subs(y, b, B(i));
end
You can also convert to double data type to see the numeric values
syms b x
y = 20*power(.05,b)*int(power(sin(x),b+1),x,0,18.19);
Best Answer