Find the intersection point between 2 curves

1 次查看(过去 30 天)
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');

回答(1 个)

Stephan
Stephan 2019-5-6
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 个评论
Antonio Sepe
Antonio Sepe 2019-5-7
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 :)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Weather and Atmospheric Science 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by