thank you very much if anyone can help me.
so, I need to create a loop that calculates integrals at each point. Say I have the following function handle
D = @(x,y) x.*(Z(x,y).^2);
from that function, I need to calculate a double integral and create the following loop
int1 = @(y) integral(@(x)D(x,y),x1,x2,'ArrayValued',true);int2 = integral(@(y)int1,y1,y2,'ArrayValued',true);c1 = int2./g % g is a scalar number
int11 = @(y) integral(@(x)D(x,y),x2,x3,'ArrayValued',true);int22 = integral(@(y)int11,y1,y2,'ArrayValued',true);c11 = int22./g % g is a scalar numberint111 = @(y) integral(@(x)D(x,y),x3,x4,'ArrayValued',true);int222 = integral(@(y)int111,y1,y2,'ArrayValued',true);c111 = int222./g % g is a scalar number...
i'm trying to do like this
x = 1:0.1:5for i = 1:length(x) D = @(x,y) x.*(Z(x,y).^2); int1(i) = @(y) integral(@(x)D(x,y),x(i),x(i)+0.5,'ArrayValued',true); int2(i) = integral(@(y)int1(i),y1,y2,'ArrayValued',true); c = int2(i)./gend
I need to plot a graph of c versus x
Best Answer