Trying to define a symbolic function to calculate its derivative. My attempted code is attached.
I am getting following error " The following error occurred converting from sym to double:
Unable to convert expression containing symbolic variables into double array. Apply 'subs' function
first to substitute values for variables."
Any help will be highly appreciated.
close all; clear; clc;
g = output(a,b);
function out = output(a,b)
for i = 1:10
p(i) = i^2+a*b;
q(i) = 2;
out = sum(p.*q);