Skip to main content
edited tags
Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k
edited body
Source Link
Benjamin
  • 347
  • 2
  • 11
CDDHybrid[s_, a1_, b1_, c1_] := 10^(a1 + b1*c1 - b1*s)*Exp[-10^(s - c1)];
CDDHybridmean[s_] := 10^(-4.9684 - 0.88*s)*Exp[-10^(s - 20.82)];
CDD40[s_, a2_, b2_, c2_] := 10^(a2 + b2*c2 - b2*s)*Exp[-10^(s - c2)];
CDD40mean[s_] := 10^(-11.0765 - 0.57*s)*Exp[-10^(s - 20.55)];
CDDNoterdaeme[s_] := 10^(4.2502 - 1.27*s)*Exp[-10^(s - 21.26)];
CDDZwaan[s_] := 10^(3.378 - 1.24*s)*Exp[-10^(s - 21.2)];

LHSHybridmean[s_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybridmean[u], {u, s, infinityInfinity}] ;
LHSHybrid[s_, a1_, b1_, c1_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybrid[u, a1, b1, c1], {u, s, infinityInfinity}] ;
LHS40mean[s_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40mean[u], {u, s, infinityInfinity}] ;
LHS40[s_, a2_, b2_, c2_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40[u, a2, b2, c2], {u, s, infinityInfinity}] ;
LHSNoterdaeme[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDNoterdaeme[u], {u, s, infinityInfinity}] ;
LHSZwaan[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDZwaan[u], {u, s, infinityInfinity}] ;

With[{a1 = Interval[-23.29 + .04 {-1, 1}], 
  b1 = Interval[0.88 + .04 {-1, 1}], 
  c1 = Interval[20.82 + .01 {-1, 1}], 
  a2 = Interval[-22.79 + .06 {-1, 1}], 
  b2 = Interval[0.57 + .07 {-1, 1}], 
  c2 = Interval[20.55 + .03 {-1, 1}]}, 
 LogPlot[{Min[LHSHybrid[s, a1, b1, c1]], LHSHybridmean[s], 
   Max[LHSHybrid[s, a1, b1, c1]], Min[LHS40[s, a2, b2, c2]], 
   LHS40mean[s], Max[LHS40[s, a2, b2, c2]], LHSNoterdaeme[s], 
   LHSZwaan[s]}, {s, 20.3, 23.1}, PlotRange -> {10^-35., 1.0}, 
  Filling -> {1 -> {3}, 4 -> {6}}, 
  FillingStyle -> {{Blue, Opacity[0.4]}, {Red, Opacity[0.4]}}, 
  PlotStyle -> {Blue, Blue, Blue, Red, Red, Red, Brown, Green, Thick},
   Frame -> True, 
  FrameLabel -> {Style["X[unit]", FontSize -> 26], Style["Y[unit]", FontSize -> 26]}, 
  FrameTicksStyle -> Directive[FontSize -> 26], 
  PlotLegend -> {Style["", 20], Style["Hybrid (2015)", 20], 
    Style["", 20], Style["", 20], Style["40 arcseconds(2015)", 20], 
    Style["", 20], Style["Noterdaeme (2009)", 20], 
    Style["Zwaan (2005)", 20]}]]
CDDHybrid[s_, a1_, b1_, c1_] := 10^(a1 + b1*c1 - b1*s)*Exp[-10^(s - c1)];
CDDHybridmean[s_] := 10^(-4.9684 - 0.88*s)*Exp[-10^(s - 20.82)];
CDD40[s_, a2_, b2_, c2_] := 10^(a2 + b2*c2 - b2*s)*Exp[-10^(s - c2)];
CDD40mean[s_] := 10^(-11.0765 - 0.57*s)*Exp[-10^(s - 20.55)];
CDDNoterdaeme[s_] := 10^(4.2502 - 1.27*s)*Exp[-10^(s - 21.26)];
CDDZwaan[s_] := 10^(3.378 - 1.24*s)*Exp[-10^(s - 21.2)];

LHSHybridmean[s_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybridmean[u], {u, s, infinity}] ;
LHSHybrid[s_, a1_, b1_, c1_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybrid[u, a1, b1, c1], {u, s, infinity}] ;
LHS40mean[s_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40mean[u], {u, s, infinity}] ;
LHS40[s_, a2_, b2_, c2_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40[u, a2, b2, c2], {u, s, infinity}] ;
LHSNoterdaeme[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDNoterdaeme[u], {u, s, infinity}] ;
LHSZwaan[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDZwaan[u], {u, s, infinity}] ;

With[{a1 = Interval[-23.29 + .04 {-1, 1}], 
  b1 = Interval[0.88 + .04 {-1, 1}], 
  c1 = Interval[20.82 + .01 {-1, 1}], 
  a2 = Interval[-22.79 + .06 {-1, 1}], 
  b2 = Interval[0.57 + .07 {-1, 1}], 
  c2 = Interval[20.55 + .03 {-1, 1}]}, 
 LogPlot[{Min[LHSHybrid[s, a1, b1, c1]], LHSHybridmean[s], 
   Max[LHSHybrid[s, a1, b1, c1]], Min[LHS40[s, a2, b2, c2]], 
   LHS40mean[s], Max[LHS40[s, a2, b2, c2]], LHSNoterdaeme[s], 
   LHSZwaan[s]}, {s, 20.3, 23.1}, PlotRange -> {10^-35., 1.0}, 
  Filling -> {1 -> {3}, 4 -> {6}}, 
  FillingStyle -> {{Blue, Opacity[0.4]}, {Red, Opacity[0.4]}}, 
  PlotStyle -> {Blue, Blue, Blue, Red, Red, Red, Brown, Green, Thick},
   Frame -> True, 
  FrameLabel -> {Style["X[unit]", FontSize -> 26], Style["Y[unit]", FontSize -> 26]}, 
  FrameTicksStyle -> Directive[FontSize -> 26], 
  PlotLegend -> {Style["", 20], Style["Hybrid (2015)", 20], 
    Style["", 20], Style["", 20], Style["40 arcseconds(2015)", 20], 
    Style["", 20], Style["Noterdaeme (2009)", 20], 
    Style["Zwaan (2005)", 20]}]]
CDDHybrid[s_, a1_, b1_, c1_] := 10^(a1 + b1*c1 - b1*s)*Exp[-10^(s - c1)];
CDDHybridmean[s_] := 10^(-4.9684 - 0.88*s)*Exp[-10^(s - 20.82)];
CDD40[s_, a2_, b2_, c2_] := 10^(a2 + b2*c2 - b2*s)*Exp[-10^(s - c2)];
CDD40mean[s_] := 10^(-11.0765 - 0.57*s)*Exp[-10^(s - 20.55)];
CDDNoterdaeme[s_] := 10^(4.2502 - 1.27*s)*Exp[-10^(s - 21.26)];
CDDZwaan[s_] := 10^(3.378 - 1.24*s)*Exp[-10^(s - 21.2)];

LHSHybridmean[s_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybridmean[u], {u, s, Infinity}] ;
LHSHybrid[s_, a1_, b1_, c1_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybrid[u, a1, b1, c1], {u, s, Infinity}] ;
LHS40mean[s_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40mean[u], {u, s, Infinity}] ;
LHS40[s_, a2_, b2_, c2_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40[u, a2, b2, c2], {u, s, Infinity}] ;
LHSNoterdaeme[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDNoterdaeme[u], {u, s, Infinity}] ;
LHSZwaan[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDZwaan[u], {u, s, Infinity}] ;

With[{a1 = Interval[-23.29 + .04 {-1, 1}], 
  b1 = Interval[0.88 + .04 {-1, 1}], 
  c1 = Interval[20.82 + .01 {-1, 1}], 
  a2 = Interval[-22.79 + .06 {-1, 1}], 
  b2 = Interval[0.57 + .07 {-1, 1}], 
  c2 = Interval[20.55 + .03 {-1, 1}]}, 
 LogPlot[{Min[LHSHybrid[s, a1, b1, c1]], LHSHybridmean[s], 
   Max[LHSHybrid[s, a1, b1, c1]], Min[LHS40[s, a2, b2, c2]], 
   LHS40mean[s], Max[LHS40[s, a2, b2, c2]], LHSNoterdaeme[s], 
   LHSZwaan[s]}, {s, 20.3, 23.1}, PlotRange -> {10^-35., 1.0}, 
  Filling -> {1 -> {3}, 4 -> {6}}, 
  FillingStyle -> {{Blue, Opacity[0.4]}, {Red, Opacity[0.4]}}, 
  PlotStyle -> {Blue, Blue, Blue, Red, Red, Red, Brown, Green, Thick},
   Frame -> True, 
  FrameLabel -> {Style["X[unit]", FontSize -> 26], Style["Y[unit]", FontSize -> 26]}, 
  FrameTicksStyle -> Directive[FontSize -> 26], 
  PlotLegend -> {Style["", 20], Style["Hybrid (2015)", 20], 
    Style["", 20], Style["", 20], Style["40 arcseconds(2015)", 20], 
    Style["", 20], Style["Noterdaeme (2009)", 20], 
    Style["Zwaan (2005)", 20]}]]
Source Link
Benjamin
  • 347
  • 2
  • 11

What is wrong with my code so it neither produces a correct plot nor an error message?

I am trying to define some initial functions and then using them to define my secondary functions and then plot the secondary functions. I am supposed to get two curves with a finite width representing the uncertainty in the model parameter sets $\{a1, b1, c1\}$ and $\{a2, b2, c2\}$ corresponding to functions $CDDHybrid$ and $CDD40$ respectively while the other two functions $CDDNoterdaeme$ and $CDDZwaan$ have no uncertainties in their parameters. Below is my code:

CDDHybrid[s_, a1_, b1_, c1_] := 10^(a1 + b1*c1 - b1*s)*Exp[-10^(s - c1)];
CDDHybridmean[s_] := 10^(-4.9684 - 0.88*s)*Exp[-10^(s - 20.82)];
CDD40[s_, a2_, b2_, c2_] := 10^(a2 + b2*c2 - b2*s)*Exp[-10^(s - c2)];
CDD40mean[s_] := 10^(-11.0765 - 0.57*s)*Exp[-10^(s - 20.55)];
CDDNoterdaeme[s_] := 10^(4.2502 - 1.27*s)*Exp[-10^(s - 21.26)];
CDDZwaan[s_] := 10^(3.378 - 1.24*s)*Exp[-10^(s - 21.2)];

LHSHybridmean[s_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybridmean[u], {u, s, infinity}] ;
LHSHybrid[s_, a1_, b1_, c1_?NumericQ] := NIntegrate[Log[10]*10^u*CDDHybrid[u, a1, b1, c1], {u, s, infinity}] ;
LHS40mean[s_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40mean[u], {u, s, infinity}] ;
LHS40[s_, a2_, b2_, c2_?NumericQ] := NIntegrate[10^u*Log[10]*CDD40[u, a2, b2, c2], {u, s, infinity}] ;
LHSNoterdaeme[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDNoterdaeme[u], {u, s, infinity}] ;
LHSZwaan[s_?NumericQ] :=  NIntegrate[10^u*Log[10]*CDDZwaan[u], {u, s, infinity}] ;

With[{a1 = Interval[-23.29 + .04 {-1, 1}], 
  b1 = Interval[0.88 + .04 {-1, 1}], 
  c1 = Interval[20.82 + .01 {-1, 1}], 
  a2 = Interval[-22.79 + .06 {-1, 1}], 
  b2 = Interval[0.57 + .07 {-1, 1}], 
  c2 = Interval[20.55 + .03 {-1, 1}]}, 
 LogPlot[{Min[LHSHybrid[s, a1, b1, c1]], LHSHybridmean[s], 
   Max[LHSHybrid[s, a1, b1, c1]], Min[LHS40[s, a2, b2, c2]], 
   LHS40mean[s], Max[LHS40[s, a2, b2, c2]], LHSNoterdaeme[s], 
   LHSZwaan[s]}, {s, 20.3, 23.1}, PlotRange -> {10^-35., 1.0}, 
  Filling -> {1 -> {3}, 4 -> {6}}, 
  FillingStyle -> {{Blue, Opacity[0.4]}, {Red, Opacity[0.4]}}, 
  PlotStyle -> {Blue, Blue, Blue, Red, Red, Red, Brown, Green, Thick},
   Frame -> True, 
  FrameLabel -> {Style["X[unit]", FontSize -> 26], Style["Y[unit]", FontSize -> 26]}, 
  FrameTicksStyle -> Directive[FontSize -> 26], 
  PlotLegend -> {Style["", 20], Style["Hybrid (2015)", 20], 
    Style["", 20], Style["", 20], Style["40 arcseconds(2015)", 20], 
    Style["", 20], Style["Noterdaeme (2009)", 20], 
    Style["Zwaan (2005)", 20]}]]

However, I am surprised that I am getting nothing out of it! Could any one see what is my mistakes?