MATLAB: Add p=3sinx^2+2cosy^3and q=3cosxy+2y^2

addition of functions

How can I add these functions in matlab

Best Answer

I’m not sure what you want.
This works:
x = linspace(0, 5, 150);
y = 0.05*x + 2.01;
p = 3*sin(x).^2+2*cos(y).^3;
q = 3*cos(x.*y)+2*y.^2;
r = p + q;
plot(x, r)
grid
EDIT Edited to incorporate the later definition of ‘y’.