Quadrature rectangles transparency in plot

1 次查看(过去 30 天)
Hi,
How can I change the transparency of the rectangles?
function [I]=bobby_85(n) % n=30; n=300;
p=1;
h=1/(n-1);
I=0;
x=0;
xv=linspace(0,1,n);
close(figure(1))
figure(1)
axis([0 1 0 1])
plot(xv,f(xv),'k')
hold on
for i=1:n-1
I=I+h*f(x);
figure(1)
plot(x,f(x),'r.','MarkerSize',10)
x=x+h;
pause(3/n^p)
end
plot(1,f(1),'r.','MarkerSize',10)
pause(3/n^p)
x=0;
for i=1:n-1
figure(1)
plot([x x],[0 f(x)],'b')
plot([x x+h],[f(x) f(x)],'b')
pause(3/n^p)
plot([x+h x+h],[0 f(x)],'b')
pause(3/n^p)
area([x x+h],[f(x) f(x)])
x=x+h;
pause(3/n^p)
end
title(['n=', num2str(n)])
text(0.1, 0.8, ['integral=',num2str(I,16)])
hold off
function [y]=f(x)
% y=exp(-x.^2);
% y=x.*sin(x);
% y=x+sin(x);
% y=x;
% y=x.^2;
y=0.2+x.*sin(10*x);
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by