Student Support Forum: 'combine two functions using if or piecewise' topicStudent Support Forum > General > Archives > "combine two functions using if or piecewise"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Lyna 05/23/12 04:08am Hello all, i solved two couples of differential equations sol[]:= NDSolve {x[t]= , y[t]= } sol1[]:= NDSolve{x1[t]= , y1[t]= } after some treatement and intermediate equations ss= sol[[]] ss1=sol[[]] i plot the result of each equation : pp1 = Plot[Evaluate[y[t] /. ss], {t, 0, 7}, AxesLabel -> {y, t}, PlotRange -> {{-10, 10}, {-1, 15}, {1, 7}}]; i want that :y[t] is active until it reachs y[t]=4 then y1[t] is active until y1[t]=0 my problem is when i want to combine these different results i used : If[y[t] < 4, Plot[Evaluate[y[t] /. ss], {t, 0, 7}], If[y[t] >= 0, Plot[Evaluate[y1[t] /. ss1], {t, 0, 7}]]] but i dont have any result; tried also piecewise Do[ Plot[Piecewise[{{Evaluate[y[t] /. ss], {y'[t]>0, y[t] < 4}}, {Evaluate[y1[t] /. ss1], {y'[t] < 0, y1[t] > 0}}}], {t, 0, 20}], {i, 1, 5}] Any suggestions? Regards and i have errors that it dosn't accept the replace all, . i verified the conditions but i don't understund why i don't have result x Attachment: automate hybride.nb, URL: ,

 Subject (listing for 'combine two functions using if or piecewise') Author Date Posted combine two functions using if or piecewise Lyna 05/23/12 04:08am Re: combine two functions using if or piecewise Michael 05/23/12 12:04pm
 Next Comment > Help | Reply To Topic