you'll need to interpolate one of your functions, f
or g
, to the other function points, for 1D functions that is achievable using interp1
.
For example:
% x1 an x2 have the same limits but different # of elements
x1 = linspace(-10,10,100);
x2 = sort(rand(1,170)*20-10); # non-unifrom points from -10 to 10
f1 = sin(x1);
f2 = cos(x2);
now say we want to multiply f1*f2, we need them to have the # of elements, so
f2i= interp1(x2,f2,x1,'spline');
will make f2 to have the same # of elements as f1, or instead
f1i= interp1(x1,f1,x2,'spline');
will make f1 to have the same # of elements as f2.