Why is my graph not right?

3 visualizzazioni (ultimi 30 giorni)
chris henkel
chris henkel il 18 Dic 2017
Commentato: Star Strider il 19 Dic 2017
Im trying to make this graph. I was unable to find symbols so I just used numbers for most of the equation (the first one). I need to plot (delta w). Ive added an attachment with the equation and what the graph should look like, if someone could help. This is what I have tried but I keep getting the wrong curve:
>> w0 = 10.^14
w0 =
1.0000e+14
>> y = 5*10.^12
y =
5.0000e+12
>> e3 = 12.1
e3 =
12.1000
>> e4 = 10
e4 =
10
>> w = 50*10.^12:10.^12:150*10.^12;
>> e1 = ((e4)-((e3)-(e4)))*(((2*(w0))*(w))/(((4*((w).^2))+((y).^2))));
>> plot(w,e1)

Risposta accettata

Star Strider
Star Strider il 19 Dic 2017
Since this was due three weeks ago, I decided to code it myself for fun. There actually seem to be some errors in the homework assignment either in the constants or the range of the independent variable. It may also be that there should be an offset, perhaps something like ‘(dw - w0)’ or some such that would centre the independent variable appropriately to reproduce the plots as posted. (I just experimented with the independent variable until I got the plots to work.)
This produces the plots:
dw = linspace(-25, 25) * 1E+12;
w0 = 1E+14;
gma = 5E+12;
est = 12.1;
einf = 10;
e1 = @(dw) einf - (est - einf)*2*w0*dw./(4*dw.^2 + gma.^2);
e2 = @(dw) (est - einf) * gma*w0./(4*dw.^2 + gma.^2);
n = @(dw) sqrt(e1(dw) + sqrt(e1(dw).^2 + e2(dw).^2))/sqrt(2);
kpa = @(dw) sqrt(-e1(dw) + sqrt(e1(dw).^2 + e2(dw).^2))/sqrt(2);
figure(1)
subplot(2,2,1)
plot(dw, e1(dw))
ylabel('\epsilon_1')
grid
subplot(2,2,3)
plot(dw, e2(dw))
ylabel('\epsilon_2')
xlabel('\omega')
grid
subplot(2,2,2)
plot(dw, n(dw))
ylabel('\it{n}')
grid
subplot(2,2,4)
plot(dw, kpa(dw))
ylabel('\kappa')
xlabel('\omega')
grid
Experiment to get the result you want.
  2 Commenti
chris henkel
chris henkel il 19 Dic 2017
thank you, that worked
Star Strider
Star Strider il 19 Dic 2017
My pleasure.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by