Why is there no plot on my figure?
이전 댓글 표시
I am trying to produce a graph of cloud height against albedo. A figure appears but no plot and I can't work out why. Thank you.
%number of droplets
N= 1120e6;
%cloud height
h= [0:1:1000];
%asymmetry parameter
g=0.858;
figure
semilogx(h,a(t(N,r(N),h),g))
function albedo = a(t,g)
% returns the cloud albedo from the measure of optical depth and asymmetry
albedo = ((1-g)*t)/(2+(1-g)*t);
end
function radius = r(n)
%returns the effective radius of the cloud droplets given the water content
% and droplet number
radius= ((3e-4*3)/(1000*4*n*pi))^(1/3);
end
function optical_depth= t(n,r,h)
%returns the optical depth of a cloud from the assumptions in Twomey 1977
optical_depth= 2*pi*n*r^2*h;
end
답변 (2개)
YOu are generating only a point data with the functions.....So you have to use a marker.
Try:
semilogx(h,a(t(N,r(N),h),g),'*r')
madhan ravi
2019년 2월 1일
편집: madhan ravi
2019년 2월 1일
albedo = ((1-g)*t)./(2+(1-g)*t);
% ^------ missed it
댓글 수: 3
EmHat
2019년 2월 1일
madhan ravi
2019년 2월 1일
Reason: Since t is a vector each element is divided by each element.
It's called element-wise operation see https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html - for better learning and understanding.
EmHat
2019년 2월 1일
카테고리
도움말 센터 및 File Exchange에서 Process Point Clouds에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!