# How can I fill the area between a function and the vertical axis x = 0, either for positive or negative values of it?

4 visualizaciones (últimos 30 días)
OSCAR ZAMORA PICAZO el 17 de Mzo. de 2016
Respondida: Mike Garrity el 17 de Mzo. de 2016

I have several diagrams which plot one function. I want to fill an area between that function (lineal, curve..)and a the vertical axis x = 0. So, how can I fill the area, either for positive or negative values of it?

The function is a piecewise function. The code of one case is:

``` y_B1 = 0:0.01:h_poste;
figure
ley_Mz_B1 = plot(Mz_B1,y_B1);grid;
title('CASO DE CARGA B (Viento 1).Ley de esfuerzos flectores')
xlabel('Momento flector Mz (N·m)');
ylabel('Altura (m)');```

where Mz_B1 is the function represented and y_B1 is the vector of independent values.

NOTE: the black area has been made using Paint.

##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Mike Garrity el 17 de Mzo. de 2016
This post I did on the MATLAB Graphics blog might give you some ideas on how to do this.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Lighting, Transparency, and Shading 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!

Translated by