MATLAB Answers

0

Find the intersection point between 2 curves

Asked by Antonio Sepe on 6 May 2019
Latest activity Commented on by Antonio Sepe on 7 May 2019
Hi there!
I'm a new matlab user so I don't know all its features.
I'm having trouble in finding the intersection point between two curves (I_moon and Moon_ref). Can you help me?
This is my code:
%------------------------------------------------------------------------%
%------------------------------------------------------------------------%
%-----------------Average radiance emitted and reflected-----------------%
%------------------------------------------------------------------------%
%------------------------------------------------------------------------%
%Target: Moon;
%Atmosphere and surface: no atmosphere;
%Surface temperature: 130 K;
%Albedo: 0.136;
%Wavelength range: 0-50 μm;
%Data from: nasa.gov
clear all;
close all;
clear global;
clc
%--------------------------------Costants--------------------------------%
c=2.998*10^8; % speed of light in vacuum
h=6.6261*10.^-34; % Planck constant
k=1.38*10.^-23; % Boltzmann constant
sigma=5.67*(10^-8); %Stephen-Boltzmann constant
L=(0.0:0.01:50); %wavelength (μm)
T=130; %Moon average temperature (K)
albedo=0.136; %Moon albedo (ad)
d=1; %Sun-Moon distance (AU)
R=1737.1; %Moon average radius (km)
r=4.66e-3; %Sun radius (AU)
T_sun=5777; %Sun average temperature (K)
Fs=1366; %Solar constant at 1 AU (W/m^2)
%----------------------------Radiance emitted----------------------------%
I_sun=3.742./((L.^5).*(exp(1.439e4./(L.*5777))-1));
I_moon=3.742./((L.^5).*(exp(1.439e4./(L.*130))-1));
%---------------------------Radiance reflected---------------------------%
Moon_ref=albedo*((r^2)/(1^2))*I_sun;
%------------------------------Absorptance-------------------------------%
F=Fs*(1./(d.^2)); %Solar constants for Moon=1366 (W/(m^2))
Rad_intercepted=F.*pi.*((R.*(10^3)).^2); %Solar radiation intercepted by Moon=1.295 (W)
Rad_absorbed=F.*(1-albedo).*pi.*((R.*(10^3)).^2); %Radiation absorbed: Moon=1.1188e+16 (W)
Abs=Rad_absorbed./Rad_intercepted; %Absorptance values for: Moon=0.864
%---------------------------Total radiance-------------------------------%
ToT_moon=Moon_ref+(Abs*I_moon);
figure4 = figure;
axes1 = axes('Parent',figure4);
hold(axes1,'on');
ylabel({'Radiance'});
xlabel({'wavelength (μm)'});
title({'Moon','(130K)'});
xlim(axes1,[1 20]);
ylim(axes1,[1e-30 1]);
set(axes1,'YMinorTick','on','YScale','log');
plot(L,I_moon,'Color',[0 0 1]);
hold on
plot(L,Moon_ref,'Color',[1 0 0]);
plot(L,ToT_moon,'Color',[0 0 0]);
hold off;
legend({'Emitted','Reflected','Total'},'Location','southeast');

  0 Comments

Sign in to comment.

1 Answer

Answer by Stephan
on 6 May 2019

create a function handle depending from wave length, that subtracts both from each other. this is the objective function for using fzero function. As result you get the interception wave length.

  1 Comment

Hi! Thanks for the answer.
I tried to use fzero funcion but it didn't work.
I solved the problem by using polyxpoly, in this way (consider data in my question):
[xint,yint] = polyxpoly(L,I_moon,L,Moon_ref);
figure4 = figure;
axes1 = axes('Parent',figure4);
hold(axes1,'on');
ylabel({'Radiance'});
xlabel({'wavelength (μm)'});
title({'Moon','(130K)'});
xlim(axes1,[1 20]);
ylim(axes1,[1e-30 1]);
set(axes1,'YMinorTick','on','YScale','log');
plot(L,I_moon,'Color',[0 0 1]);
hold on
plot(L,Moon_ref,'Color',[1 0 0]);
plot(L,ToT_moon,'Color',[0 0 0]);
mapshow(xint,yint,'Displaytype','point','Marker','o');
legend({'Emitted','Reflected','Total','λ equiv.'},'Location','southeast');
hold off
Thx anyway :)

Sign in to comment.