## 79 Reputation

19 years, 293 days

## Expectation maximization algorithm...

This sounds like you need the expectation maximization algorithm.

http://en.wikipedia.org/wiki/Expectation-maximization_algorithm

Jan

## I know what the problem is...

It turns out that I was wrong.  The two techniques do not produce mathematically equal results.

Case 1: Add the outputs of the BodePlot

In this case we take the individual transfer functions and calcuate the Bode plot for each and sum them together.  While calculating the Bode plot, we take an absoute value of the transfer function.  So mathematically, we have something like this:

abs(sys[1,1]) + abs(sys[1,4]) + abs(sys[1,5])

In this case we sum the transfer functions together and then calculate the Bode plot from the combined system.  This would correspond to a new system that looks something like this:

```              +-----------+
+---| sys[1,1]  |-----+
|   +-----------+     |
|   |                 |
|   +-----------+    /-\
-----+---| sys[1,1]  |---| + |--->
|   +-----------+    \-/
|   |                 |
|   +-----------+     |
+---| sys[1,1]  |-----+
+-----------+
```

Or mathematically

abs(sys[1,1] + sys[1,4] + sys[1,5])

Since the abs function in the BodePlot is non-linear the two cases are not the same.  Which case you would want to use depends on what you are trying to do.

Jan

PS: I would also increase the precision of the caculations using the Digits variable, for example if you do

Digits := 30

at the begining of the worksheet.

## Alternate solution...

You can also add up the three transfer functions and create another systme object.  Then you can plot the bode plot using htis new object.

```sys2 := TransferFunction(sys:-tf[1, 1] + sys:-tf[1, 4] + sys:-tf[1, 5]);

```

And then

```BodePlot(sys2, decibels = false, numpoints=1000, range=10..1000);
```

In this example, you may want to increase the number of points you are plotting (with the numpoints option) and zoom in a bit (with the range option).

Jan

PS: Here is Maple's best kept secret.  You can use the legend option in the BodePlot command to label the three curves in the original bode plot, i.e.

`BodePlot(sys, decibels = false, subsystem = [[1, 1], [1, 4], [1, 5]], legend=["Output 1", "Output 4", "Output 5"])`

And if you want to get really fancy, then you can also change the color, thickness, and linestyle, i.e.

```BodePlot(sys, decibels = false, subsystem = [[1, 1], [1, 4], [1, 5]], legend=["Output 1", "Output 4", "Output 5"], thickness=[1,2,3], color=[red, green, blue], linestyle=[solid, dash, dashdot]);
```
```
```

## You can drag the files onto Maple...

If you are using standard Maple, you can just drag the file onto the worksheet. This will open the file in another tab of the same instance. Jan

## Shift+Enter...

Hold down shift and press enter. This will advance the cursor to the next line, while staying in the same execution group. Jan

Hi, The command readline(terminal) produces the maplet. What you type into the window gets assigned to a variable r, and the loop continues, as long as the value of r is an empty string, i.e. the user did not type anyting. Once you type something in, then the loop quits. Jan Applications Engineer, Maplesoft

## Use tables...

Also, your figure does not seem to fit on the page. One way to deal with that is to create a table that is 100% of the page width and then place the figure inside the table. As the worksheet is printed, the table is rescaled, which in turn rescales the image inside it. If you do not want a border around the figure, you can make the table invisible. You can also use the tables to line up your equations, instead of using the tabs. Jan Applications Engineer, Maplesoft

## Creating a vector...

Here is how to create a vector and fill it with values from 0 by 0.02 to 0.5: v := Vector(26, x -> (x-1)*0.02); Here is what is happening: The first argument is the size of the vector. There are 26 entries between 0 and 0.5. The second argument is an initialization function that takes an index x and returns (x-1)*0.02, and this function is called to initialize every entry of the vector. Note that the indexing is one based, and therefore we need to have (x-1) in order to start with 0 in the first entry. Jan Applications Engineer, Maplesoft

## We are looking into it...

Hello Tom, We are currently looking at updating the toolbox to run under LabVIEW 8. Jan Applications Engineer, Maplesoft

## showstat also works....

The function showstat also works. e.g. showstat(simplify); Jan Jan Bakus Applications Engineer, Maplesoft

## polygon in the plottools package...

You can use the polygon command in the plottools package. plots[display](plottools[polygon]([[-2,-4], [1,3], [2,-2]]), color=red, thickness=2); Jan Bakus Applications Engineer, Maplesoft

You have to create a bookmark where you want to hyperlink to. Here is how: 1) place the cursor to the destination of the hyperlink 2) go to the menu Format -> Bookmarks 3) Click on the button New 4) Type in the name of the bookmark Now you can create the hyperlink to point to the bookmark 1) highlight the text that you want to hyperlink 2) right click on it 3) Select Convert to -> Hyperlink 4) Change the type to Worksheet 5) Select the bookmark that you created 6) click ok Jan Applications Engineer, Maplesoft

## numer and denom...

To get the numerator: numer (fr1); To get the denominator: denom (fr1); Jan Applications Engineer, Maplesoft

## problem with spaces...

The command "cd c:/documents and settings/user/my documents" does not even work in straight Matlab. The spaces in "documents and settings" are causing the problem. This should do the trick. Matlab:-evalM("cd 'c:/documents and settings/user/my documents'"); Jan Applications Engineer, Maplesoft

## Maple file I/O...

If all you want is to be able to load and save matrices, you should have a look at MatrixImport and MatrixExport. These procedures can read and write data files directly to matrices. The files can be in different formats, and one of the formats is also MATLAB. To do a low level I/O, you should have a look at fopen and fclose to open and close the files. To read and write text you may want to look at fscanf, fprintf, readline and writeline. To read and write binary data, have a look at readdata and writedata. There is also a FileTools package that contains a collection of file manipulation utilities. All of these procedures have help pages with examples. Hope this helps, Jan Bakus Applications Engineer, Maplesoft
 1 2 Page 1 of 2
﻿