Area in a function

2 visualizzazioni (ultimi 30 giorni)
Fernando Moreno
Fernando Moreno il 26 Gen 2022
Risposto: David Hill il 26 Gen 2022
Im trying to fill the area under a function but I dont know how to exactly do it, I want to plot the area between [-1, 1]
syms f(x)
f=1-x^4
f = 
t=0
t = 0
I=int(f)
I = 
Area=subs(I,1)-subs(I,-1)
Area = 
fplot(f,[-1,1])
hold on
fplot(t,'b')

Risposte (1)

David Hill
David Hill il 26 Gen 2022
x=-1:.001:1;
f=1-x.^4;
g=zeros(size(x));
plot(x,g,x,f);
x2 = [x, fliplr(x)];
inBetween = [g, fliplr(f)];
fill(x2, inBetween, 'g');

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by