Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13279 > unrolled thread
| Started by | Alexei Boulbitch <Alexei.Boulbitch@iee.lu> |
|---|---|
| First post | 2013-01-26 06:38 +0000 |
| Last post | 2013-01-26 06:38 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: something wrong with my code?? Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2013-01-26 06:38 +0000
| From | Alexei Boulbitch <Alexei.Boulbitch@iee.lu> |
|---|---|
| Date | 2013-01-26 06:38 +0000 |
| Subject | Re: something wrong with my code?? |
| Message-ID | <kdvtl4$fpd$1@smc.vnet.net> |
First of all, this might give seasoned Mathematica users some serious
eye sores cause I'm a newb at this xD
f[x_] := (1^-9) (Exp[38.629 x] - 1);
data = Table[if[[f[x], {x, -5, 5, 0.01}] > 0.005, 0.005, f[x]]];
ListPlot [data, DataRange -> {-5, 5}, Joined -> True,
PlotRange -> {0, 0.01}, PlotStyle -> {Thickness[0.005]}]
What I want to do this is do a plot of a sweep from -5 to 5 with 0.01
stepsize, and if the output value exceeds 0.005, the output value will
just be 0.005. It will kind of look like a heavyside step function/unit
step function.
Any help would be greatly appreciated xD.
Hi,
Try this, it is probably what you had in mind:
f[x_] := 10^-9*(Exp[38.629 x] - 1);
data = Table[
If[f[x] > 0.005, {x, 0.005}, {x, f[x]}], {x, -5, 5, 0.01}];
ListPlot[data, PlotRange -> {0, 0.01},
PlotStyle -> {Red, PointSize[0.005]}]
However, the problem is more simple that that. Try this:
f2[x_] :=
If[10^-9*(Exp[38.629 x] - 1) > 0.005, 0.005,
10^-9*(Exp[38.629 x] - 1)];
Plot[f2[x], {x, -5, 5}]
Your code contains syntax errors. I advise you to have a look into the Math=
ematica basics, it pays off.
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44
e-mail: alexei.boulbitch@iee.lu
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web