Joe Riel

9660 Reputation

23 Badges

20 years, 14 days

MaplePrimes Activity


These are replies submitted by Joe Riel

One way to understand it is to realize that the response of a [suitable] system to an input equals the inverse laplacian of the product of its transfer function and the laplacian of the input.  But the laplacian of an impulse, Dirac(t), is 1, so the impulse response is merely the inverse laplacian of the transfer function.

Let's start with about the simplest system possible, a unity-gain system.

with(DynamicSystems):
sys := TransferFunction(1):
ImpulseResponse(sys);
                                       [Dirac(t)]

The impulse response of this system is the dirac "function".  Plotting that just returns a zero-plot because Maple (reasonably) does not plot an impulse.

Now let's consider an integrator, which has transfer function 1/s.

sys := TransferFunction(1/s):
ImpulseResponse(sys);
                                        [1]

The impulse response is the unit function. It should be a unit-step function, however, the impulse response is only valid for t>0.

One way to understand it is to realize that the response of a [suitable] system to an input equals the inverse laplacian of the product of its transfer function and the laplacian of the input.  But the laplacian of an impulse, Dirac(t), is 1, so the impulse response is merely the inverse laplacian of the transfer function.

Let's start with about the simplest system possible, a unity-gain system.

with(DynamicSystems):
sys := TransferFunction(1):
ImpulseResponse(sys);
                                       [Dirac(t)]

The impulse response of this system is the dirac "function".  Plotting that just returns a zero-plot because Maple (reasonably) does not plot an impulse.

Now let's consider an integrator, which has transfer function 1/s.

sys := TransferFunction(1/s):
ImpulseResponse(sys);
                                        [1]

The impulse response is the unit function. It should be a unit-step function, however, the impulse response is only valid for t>0.

Then you better consider using a logarithmic scale for the domain, because otherwise you won't see much.  That is, in a typical example, only the bottom 0.5% of the datapoints have non-zero values.

Then you better consider using a logarithmic scale for the domain, because otherwise you won't see much.  That is, in a typical example, only the bottom 0.5% of the datapoints have non-zero values.

If you want to preserve the order, use ?ListTools[MakeUnique]

If you want to preserve the order, use ?ListTools[MakeUnique]

Just insert it into the format string in the call to ?nprintf

nprintf("%A(%A CD)=%s", ...)

Just insert it into the format string in the call to ?nprintf

nprintf("%A(%A CD)=%s", ...)

Thanks for the report, Doug. I like your idea of having select MaplePrime members occasionally host webinars.  I'm trying to put together a screencast that may interest some here, it could be a possible candidate. I'm looking forward to the changes to the MaplePrimes scoring system [given the current nonsense, an improvement to the spam blocking may receive higher priority].

 

While the procedures may sort, neither does so efficiently.  The first is really bad, it is O(n^4).  The second is O(n^2).  While the cocktail sort is not a particularly good sorting algorithm, it can be implemented more efficiently. 

Don't nest the two loops, they should be sequential.  That is, first sort in one direction, and then in the other. 

Keep track of whether a swap was made.  If no swap was made during either loop, then exit, you know that the Array is sorted. 

Increment the start index by one and decrease the finish index by one each time through.  The reason is that during each forward pass, the biggest element will be pushed to the end, so the next time through you don't need to compare the last two element.  Conversely with the the "reverse" loop. 

The print statement at the end doesn't really belong there.  Just return NULL (or the Array).  The Array is sorted in-place.

While the procedures may sort, neither does so efficiently.  The first is really bad, it is O(n^4).  The second is O(n^2).  While the cocktail sort is not a particularly good sorting algorithm, it can be implemented more efficiently. 

Don't nest the two loops, they should be sequential.  That is, first sort in one direction, and then in the other. 

Keep track of whether a swap was made.  If no swap was made during either loop, then exit, you know that the Array is sorted. 

Increment the start index by one and decrease the finish index by one each time through.  The reason is that during each forward pass, the biggest element will be pushed to the end, so the next time through you don't need to compare the last two element.  Conversely with the the "reverse" loop. 

The print statement at the end doesn't really belong there.  Just return NULL (or the Array).  The Array is sorted in-place.

with(DynamicSystems):
sys := TransferFunction(1/(1+s)):

bodeplot := proc()
local magplot, phsplot;
uses DS=DynamicSystems;
    magplot := DS:-MagnitudePlot(args, 'color=blue');
    phsplot := DS:-PhasePlot(args, 'color=red');
    plots:-display(Vector([magplot,phsplot]));
end proc:

bodeplot(sys);

One way is

(**) L := [seq(1..10)];
                                    L := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(**) E := ListTools:-LengthSplit(L,2);
                                    E := [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]

(**) map(op,[E]);
                                           [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

If you use Vectors, then you can easily split and join them:

(**) V := Vector(L):
(**) V1 := V[..5]:
(**) V2 := V[6..]:
(**) V3 := Vector([V1,V2]);

Arrays are a bit trickier ...

One way is

(**) L := [seq(1..10)];
                                    L := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(**) E := ListTools:-LengthSplit(L,2);
                                    E := [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]

(**) map(op,[E]);
                                           [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

If you use Vectors, then you can easily split and join them:

(**) V := Vector(L):
(**) V1 := V[..5]:
(**) V2 := V[6..]:
(**) V3 := Vector([V1,V2]);

Arrays are a bit trickier ...

You have to adjust the indices (if you'll look at my original response, you'll note that there was a comment about that).  That is, you don't want to stop at the lowest index (r) if you are attempting to access L[r-1].  Instead, you have to stop at r+1.  Similarly when looping in the other direction.

First 102 103 104 105 106 107 108 Last Page 104 of 195