# How to tell composed functions apart?

2 views (last 30 days)
Tanja Gesslbauer on 6 Jan 2018
Answered: Manan Mishra on 10 Jan 2018
Hello, I've had a problem with plotting compositions of 4 functions.
X_air = 102.73;
X_dg = 255;
K_dg=1.459265890778872e+02;
alpha_dg=0.588240715141462;
beta_dg=0.482351856971708;
gamma_true_sk=10.591100000000000;
x_peak_sk=1.952100000000000e+02;
G_dg=76.609744634184550;
syms x;
syms y;
syms z;
syms w;
syms v;
%phi
f=((x-X_dg)/(X_air-X_dg));
%K_hom_sk
g =((1-y)*(K_dg))/((1-y)+y/(1-(alpha_dg)));
%G_hom_sk
j = ((1-y)*(G_dg))/((1-y)+y/(1-(beta_dg)));
%E_hom_sk, K_hom_sk wird zu v, G_hom_sk wird zu w
m =((9*v*w)/(3*v+w));
%ny_hom_sk
n=((3*v-2*w)/(6*v+2*w));
%probability density function
h=((1)/((pi*gamma_true_sk)*(1+((z-x_peak_sk)/(gamma_true_sk))^2)));
a = compose(h,g,f);
b = compose(h,j,f);
c = compose(h,m,j,g,f);
d = compose(h,n,g,j,f);
fplot(a);
axis([0 500 0 0.035]);
hold on
fplot(b);
hold on
fplot(c);
hold on
fplot(d);
hold on
When I try to plot all 4 of them, I get only 3 plots, so the last one, d, is missing, and I have no clue why.
Could any of you possibly tell me what might be causing this error?
Greetings, Tanja :-)

Manan Mishra on 10 Jan 2018
You can't see the fourth plot because the plots for 'c' and 'd' are overlapping. You can run the "fplot" commands one by one and observe the plot for 'd' overlapping the plot for 'c'.
You can also use the "legend" commands to show legends in your plot and see the which color represents which plot.
You can run the following commands:
>> fplot(a);
>> axis([0 500 0 0.035]);
>> hold on
>> fplot(b);
>> fplot(c);
% Observe the figure before running these
>> fplot(d);
>> legend('a','b','c','d')

### Categories

Find more on Legend 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!