How can I fill the area between a function and the vertical axis x = 0, either for positive or negative values of it?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
OSCAR ZAMORA PICAZO
am 17 Mär. 2016
Beantwortet: Mike Garrity
am 17 Mär. 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; Mz_B1 = -((y_B1<=h_hc).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1.*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1))+((y_B1>h_hc)&(y_B1<=h_CdPa)).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1.*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1)+M_hc+(Esf_rad_hc+Qwc(1)).*(y_B1-(h_hc+ht)))+((y_B1>h_CdPa)&(y_B1<=cdg_mensula_y)).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1.*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1)+M_hc+(Esf_rad_hc+Qwc(1)).*(y_B1-(h_hc+ht))+M_CdPa+(Esf_rad_CdPa_B+Qwc(3)).*(y_B1-(h_CdPa)))+((y_B1>cdg_mensula_y)&(y_B1<=h_sust)).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1)+M_hc+(Esf_rad_hc+Qwc(1)).*(y_B1-(h_hc+ht))+M_CdPa+(Esf_rad_CdPa_B+Qwc(3)).*(y_B1-(h_CdPa))+M_mensula)+((y_B1>h_sust)&(y_B1<=h_Feed)).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1.*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1)+M_hc+(Esf_rad_hc+Qwc(1)).*(y_B1-(h_hc+ht))+M_CdPa+(Esf_rad_CdPa_B+Qwc(3)).*(y_B1-(h_CdPa))+M_mensula+M_sust+(Esf_rad_sust+Qwc(2)).*(y_B1-(h_sust+ht)))+((y_B1>h_Feed)&(y_B1<=h_poste)).*(R_Mz_v1_B+R_Vx_B1.*y_B1+((1/2).*y_B1.*y_B1*(Qwstr1/h_poste)*(1/3).*y_B1)+M_hc+(Esf_rad_hc+Qwc(1)).*(y_B1-(h_hc+ht))+M_CdPa+(Esf_rad_CdPa_B+Qwc(3)).*(y_B1-(h_CdPa))+M_mensula+M_sust+(Esf_rad_sust+Qwc(2)).*(y_B1-(h_sust+ht))+M_Feed+(Esf_rad_Feed_B+Qwc(4)).*(y_B1-(h_Feed)))); 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 Kommentare
Akzeptierte Antwort
Mike Garrity
am 17 Mär. 2016
This post I did on the MATLAB Graphics blog might give you some ideas on how to do this.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!