I have two set data and I want to calculate the area in different x and plot the area curve with respect to X
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Misi
el 10 de Oct. de 2023
Comentada: Star Strider
el 10 de Oct. de 2023
For example
x=[1 1.5 1.7 2 2.2 2.6 2.8];
y=[0 2 6 7 8 10 5];
Now I wanted to plot the area under these data with respect to x
0 comentarios
Respuesta aceptada
Star Strider
el 10 de Oct. de 2023
Perhaps this —
x=[1 1.5 1.7 2 2.2 2.6 2.8];
y=[0 2 6 7 8 10 5];
int_y = cumtrapz(x, y);
figure
plot(x, y, 'DisplayName','Data')
hold on
plot(x, int_y, 'DisplayName','Cumulative Integral of ‘y’')
hold off
grid
xlabel('x')
ylabel('y')
legend('Location','NW')
.
2 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!