Why is there no plot on my figure?
Show older comments
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
Answers (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
on 1 Feb 2019
Edited: madhan ravi
on 1 Feb 2019
albedo = ((1-g)*t)./(2+(1-g)*t);
% ^------ missed it
3 Comments
EmHat
on 1 Feb 2019
madhan ravi
on 1 Feb 2019
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
on 1 Feb 2019
Categories
Find more on Process Point Clouds in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!