0
$\begingroup$

I'm trying to combine two plots

rho0bar = rho0 - k11^2 mu0/w^2;
rho1bar = rho1 - k11^2 c66/w^2 - k11^2 c64^2/(w^2 c44);
rho2bar = rho2 - k11^2 mu2/w^2;
R1 = (rho1bar (rho2bar/mu2)^(1/2) + 
 rho2bar (rho1bar/c44)^(1/2))/(rho2bar (rho1bar/c44)^(1/2) - 
 rho1bar (rho2bar/mu2)^(1/2));
R0 = (rho0bar (rho1bar/c44)^(1/2) + 
 rho1bar (rho0bar/mu0)^(1/2))/(rho1bar (rho0bar/mu0)^(1/2) - 
 rho0bar (rho1bar/c44)^(1/2));

The first plot

plot1 = Plot[
Chop[R0 /. {rho1 -> 3000, k11 -> 1.2, c66 -> 2 10^9, 
 c64 -> 3.1 10^9, c44 -> 2.9 10^9, rho2 -> 3456, rho0 -> 3556, 
 mu2 -> 2345, mu0 -> 2500}], {w, 10^4, 10^5}, PlotRange -> All]

and the second

plot2 = Plot[
 Chop[R1 /. {rho1 -> 3000, k11 -> 1.2, c66 -> 2 10^9, 
 c64 -> 3.1 10^9, c44 -> 2.9 10^9, rho2 -> 3456, rho0 -> 3556, 
 mu2 -> 2345, mu0 -> 2500}], {w, 10^4, 10^5}, PlotRange -> All]

with

Show[plot1,plot2]

But I get the error that it cannot combine plots. How can I do this?

Also, I wondering, how would I plot a combination of these functions for example

R0*R1

Thank you in advance!

$\endgroup$
  • $\begingroup$ Hi, welcome to the Mathematica Stack Exchange! I don't get an error when I run your unmodified code - can you elaborate on the error message you receive? Also, what version of Mathematica are you using? I've included an example of how to plot the combined functions in this cloud notebook, please check it out! $\endgroup$ – Carl Lange Jan 31 at 15:30
1
$\begingroup$
rho0bar = rho0 - k11^2 mu0/w^2;
rho1bar = rho1 - k11^2 c66/w^2 - k11^2 c64^2/(w^2 c44);
rho2bar = rho2 - k11^2 mu2/w^2;
paras = {rho1 -> 3000, k11 -> 1.2, c66 -> 2 10^9, c64 -> 3.1 10^9, 
   c44 -> 2.9 10^9, rho2 -> 3456, rho0 -> 3556, mu2 -> 2345, mu0 -> 2500};
R1 = (rho1bar (rho2bar/mu2)^(1/2) + 
      rho2bar (rho1bar/c44)^(1/2))/(rho2bar (rho1bar/c44)^(1/2) - 
      rho1bar (rho2bar/mu2)^(1/2)) /. paras;
R0 = (rho0bar (rho1bar/c44)^(1/2) + 
      rho1bar (rho0bar/mu0)^(1/2))/(rho1bar (rho0bar/mu0)^(1/2) - 
      rho0bar (rho1bar/c44)^(1/2)) /. paras;

Plot[{R0, R1}, {w, 10^4, 10^5}]

Plot[R0*R1, {w, 10^4, 10^5}, PlotRange -> All]
$\endgroup$
  • $\begingroup$ Hi, the combined plot doesn't seem to give the correct result. $\endgroup$ – user62680 Jan 31 at 14:52
  • $\begingroup$ @user62680 Then you should check your equations. Plot command will plot whatever you provide to it. $\endgroup$ – zhk Jan 31 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.