area of the shaded part above or under the baseline
2 次查看(过去 30 天)
显示 更早的评论
hello
i want a way so i can know the area of the shaded part above the base line and under it so i can multiple with the width of the road to get cut and fill informations
this my code till now
clc
clear
station = input('enter number of stations');
width = input('enter the width ');
compact = input('enter the compaction factor ');
x = 0:50:station*50;
y=1:station+1;
for i=1:station+1;
y(i) = input('Please input the elevation ');
end
Mean=mean(y);
[Offset, fv] = fzero(@(b) trapz(x, y-b), 0);
y_above = y - Offset;
y_below = max(-y_above,0); % Take the part below y_split
y_above = max(y_above,0); % Take the part above y_split
A_above = trapz(y_above);
A_below = trapz(y_below);
area(x,y,Offset);
grid on; set(gca,'layer','top');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/217712/image.png)
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!