I am trying to define an equation set, in which the function is very similar to a square wave, but instead, it is defined piecewise at each interval. Now I need to evaluate the equation at each interval with different parameters in it. my code is as below:

cur[tim_,R_]:= f{tim,R};
Plot[Table[Piecewise[{{cur[tim], tim < Pi}, {-cur[tim], Pi < tim < Pi}}],{R,1*10^6, 10*10^6, 1*10^6}], {tim, 0, 2 Pi}] 

Can someone please help me how to solve this? the above code did not work. Your help is much appreciated.

  • 1
    $\begingroup$ I'm afraid you have a number of basic syntax errors. First, the syntax f{ } does not mean anything, you probably mean f[ ]. Second, you define cur with two arguments, but when you call it, you only call it with one argument. Third, the condition Pi < tim < Pi is empty. But even so, it's hard to see what you are actually trying to define. $\endgroup$ – bill s Oct 20 '18 at 15:33
  • $\begingroup$ @Bills thank you for your time. I am a beginner in Mathematica and made syntax errors in my earlier post. But i found solution to my problem in @ mathematica.stackexchange.com/questions/69563/… thank you for your help. $\endgroup$ – Sagar Hp Oct 21 '18 at 15:06

Your Answer

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

Browse other questions tagged or ask your own question.