How to graph 'trapz' function

20 visualizzazioni (ultimi 30 giorni)
Max Payne
Max Payne il 5 Ago 2019
I am using a trapz function to estimate the area under a function, and am getting the answer, but I was wondering if there was any way to graph the trapeziums that the function is using to calculate the area, rather than just getting an answer down the bottom.
Side note: does anyone know why my ylim is giving an error of "Array indices must be positive integers or logical values"?
Thanks!
x=0:0.1:6;
y=(30-(exp(-2.3*x)*30))/(0.6*57400)*100-(0.015*x)
plot(x,y)
ylim ([0 0.07])
Q = trapz(x,y)
  1 Commento
Walter Roberson
Walter Roberson il 5 Ago 2019
Check, you might have accidentally created a variable named ylim

Accedi per commentare.

Risposte (0)

Tag

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by