Message Boards Message Boards

GROUPS:

Create partial displays in this Plot?

Posted 2 years ago
2587 Views
|
7 Replies
|
0 Total Likes
|

In the attached notebook I want the function y11[x_] to display only up to t = d = 0.68, and not all the way up to t= 1.0. I have tried all kinds of variations of the Plot statement, but to no avail.

Is it at all possible to produce the plot I want?

Any help will be greatly appreciated.

Strange

Attachments:
7 Replies

Parameter d has the value 0.68. So the plot interval is [0.68,0.68] After the modification, Plot[] works as you want.

Attachments:

Hello Valerie,

I wonder whether there might be a typo in your answer. In my end, at least, inserting [0.68,0.68] as the plot interval for y11 produces an error, and no wonder since this gives a plot range of zero.

Or am I dense?

Strange

May be I was not clear enough in my explanation! So... The plotting interval of the first Plot[] function is [0,1], the second - [d, 1]. I mean that if in the first interval you put [0,d], you obtain that the intersection of intervals is [d,d], or [0.68, 0.68]. I set for the both Plot[] functions the same interval [0,d], and the issue disappeared.

I still cannot get the plot to work. - The final plot should range as 0 <= t <= 1.0. Substituting as I understand you suggest does not produce a plot from zero to 1.0, with the first function ending at t = 0.68, and the second function beginning at t = 0.68.

Is it possible that you could apply your corrections to my notebook, and attaching the corrected notebook to your answer? (I include a copy of my notebook as an attachment, for your convenience).

Thanks for your patience!

Attachments:

Here you are:

s = 1.0 ;   (* in milliseconds *)
eV = 10.;
r1 = 20.;   (* in kiloOhms *)
r2 = 20.;     (* in kiloOhms *)
d = 0.68;
per = 8 * s;
cap = 1.0;        (* in microFarads *)
tau1 = r1/(r1 + r2) * cap;
y11[t_] := eV * r1/(r1 + r2) * (1. - E^(-t/tau1))
y110 = y11[d];
tau2 = r1 * cap;
y12[t_] := y110 * E^((-t + d)/tau2);
Plot[Piecewise[{{y11[t], t < d}, {y12[t], t >= d}}], {t, 0, 1}, 
 PlotTheme -> "Detailed"]

enter image description here

Wonderful! - Thank you very much indeed.

Best regards,

Strange

Piecewise is really elegant. But you could do it conventionally (using Mma 7 I don't have the Option PlotTheme)

Show[ Plot[y12[t], {t, d, 1.0 }, PlotRange -> {0, 4},   AxesOrigin -> {0, 0}], Plot[y11[t], {t, 0, d}]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract