Quadrature rectangles transparency in plot

조회 수: 1 (최근 30일)
Bobby Fischer
Bobby Fischer 2020년 3월 22일
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