I had defined those values above and it was still not working. However, I did discover that the values for the time variable t, must come before the Pulse function. I had t after and it was not working. I moved Pulse down below where I set values for t and now it works.
I still have one issue though. In my worksheet I am using this function to describe a road surface, which is artificially created by having wooden boards 1: high by 12" wide placed on the surface of the road at a spacing of 30" center to center. So in this case A=1 inch, T= 30 inch, d= 2.5 (unitless). However, when I add the units, the Pulse no longer works. Am I doing something wrong or must Pulse have unitless variables?
I had two typos:
Boards are 1" high (not 1:)
d is 0.4 (not 2.5)
Period is 2.5 ft, peak width (top of pulse) is 1 ft
so 1 ft / 2.5 ft = 0.4, which is duty cycle
I guess you could get help more to the point if you post your worksheet and also show what you are going to use your pulse-function for.
BTW, I only glanced over this thread but it could be that Luc's function should read pulse(t,A,T,d):=A* (mod(t,T)<d*T)
I don't see where you implemented Luc's function. I just see an attempt to approximate the pulse via a partial sum of a fourier series.
What I noticed is this:
1) It seems that you wanted to define a range for t, but the region t:=0s,0.3s .. 4.2s is not a math region but is mere text. If you create a true range you should use a much smaller step size, like t:=0s,0.3 ms .. 4.2 s
2) If you define t as a range with the correct time unit, the plot "Road Contour as a Function of Distance" will fail because you used "Displacement(X(t))" on the abscissa. I guess it should just be "Displacement(t)".
The name T for the period in distance is a bit misleading. As you want to define y as a function of time, the correct period seems to be T/speed.
Take a look at the attachment if it is what you are looking for.
When I was asked to post the worksheet, I had tried several different things suggested by both Luc and by -MFRa-. I guess I had deleted part of Luc's equation when I posted the worksheet here. But I had it in there at one time and it was not working with the units on the fixed value variables (A,T, etc.)
What I am trying to accomplish is this:
1) I want two equations one that describes the vertical displacement (amplitude, measured in length units) of a rectangular wave as a function of time and another as a function of distance (speed in mph times time in seconds, giving length)
2) In this problem I am "driving" the pictured Baja vehicle suspension over a road that has a washboard surface, created by a series of boards 1" high by 12" wide, spaced 30" apart when measured center to center. This essentially would a rectangular wave, right? I could ultimately create this road surface by placing these boards over a flat surface on the road. If you follow on down the worksheet you can see what I am ultimately doing with this.
I originally had the attached worksheet to describe the road surface, but wanted to change it to a "constructed" sinusoidal input that we are creating by the board surface. So that sinusoidal surface becomes a rectangular wave surface when created the way I describe. So to accomplish this I wanted to replace the y(t) function in the attached worksheet with a rectangular function and have the rest of the worksheet still be correct. I hope this now all makes sense.
That is awesome, and it does exactly what I want as far as I can tell.
Just out of curiosity, I noticed your comment near the bottom that says we need to use a larger time step there otherwise there would be too many points to plot. And you used 0.1, but suggested I could use 0.01, but that you were not patient enough for that to run. What version of Mathcad are you running? And are you using 32 or 64 bit? Reason I ask, we currently have version 15, but I have an 8 core processor running 64-bit Windows 10. I am wondering how much speed I would gain by upgrading to the current version 6 Prime.
Mathcad 15 (and versions back to 4 or so) is a 32-bit application. It is limited to using a single core, no matter how many cores your computer may have. If you run two instances of Mathcad 15 side by side, they can each use their own core though.
Prime versions 1 through 4 came in two flavours: 32 and 64-bit. Since Prime 5 it's only 64-bit (you cannot install Prime 5 or 6 on a 32-bit OS).
Regarding speed the story is complicated. Starting up the application, entering equations and especially number of mouse clicks to accomplish tasks, takes more in Prime than it does with Mathcad 15, as does closing the program. Once equations are entered, when it comes to actually calculating the same problem, it depends on whether or not the application can make use of multiple cores. There you might see Prime outperform Mathcad.
You can give it a try. Download and install Prime 6 and take (up to) 30 days to find out for yourself if it is an improvement for you. Note that using Prime is definitely a change with respect to Mathcad 15.
Note also that there is a migration path for mathcad sheets. You can convert a Mathcad .mcd or .xmcd sheet to a Prime .mcdx sheet, but there's no way back. Also there's no way from Prime 6 to save as a Prime 5 or less sheet.