cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

MathCAD 14 3D Plot of transfer function

ptc-5430751
1-Newbie

MathCAD 14 3D Plot of transfer function

Hi,

I have problem with plotting 3D surface of my fransfer function. I have defined my function, but when I try to plot itit says that my transfer function should be a scalar, or matrix.

I am attaching my mathcad file. Can anyone tell me what am i doing wrong please? Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Martin, in case you are still with us and prefer a simpler variant, see attached. I tried to stay close to what you tried but you should keep in mind that you may have better control using methods like CreateMesh() as shown by Andy.

You can "plot a function name" and in fact in 3D-plots you must use the function name alone without any parameters to make the plot work. But to plot a surfcace in a 3D plot, you must use a function in two variables. So your function sys1() (and also Wk()) must be (and are) dependend on omega AND T.

If you fix this you can plot your surface exactly as you tried. You don't need any range variables (they won't help here anyway), but you must set the range for the two parameters in the plot format menu, tab QuickPlot data. Here you set start, end value and grid number similar to the parameters of createmesh(), but you are not allowed to use variables here, so createmesh() may have its merits. The default range for those parameters includes zero and that the reason you get an error (divide by zero) unless you change the plot range.

The look of your surface may change significantly if you change the grid size only slighty. This is due to the nature of your function. E.g. you have poles for every omega being an integer multiple of 2*pi/T and depending how close a grid point comes to this value you may see a more or less distinct peak. And playing around with the grid size and/or the range for omega and T is much easier with Createmesh() than doing it in the format menu. So I'd prefer the way Andy had shown.

01.02.png

View solution in original post

5 REPLIES 5

Hi Martin,

You have defined sys1 as a function of omega, but I guess want to plot against omega and T.

So first need to redefine sys1 as a function of these parameters.

3D plots can be dificult: the best way I know is to use createmesh or createspace to define plotable arrays (as the attachement).

Note that mathcad may have difficulty displaying the plot.

To see the plot I had to change the display colour depth from 32bit (default) to 16bit.

Without this the plot is blank, but no errors

Regards

Andy

Hi,

Thank you very much. I would like to ask you now, what are those numbers in S:= CreateMesh (sys1, 1, 1000, 1, 32, 50, 32). I understand, that 1, 1000 is my w (omega) and 1, 32 is T, but what are 50, 32?

Thank you

Hi Martin,

Info from the mathcad help files:

Capture.PNG

Capture.PNG

Hope this helps.

Regards

Andy

Hi Marten,

There are some fundamental issues with your use of the software. It is powerful software so have spent some time that you can understand and use it to full potential. Have shown you how to get started.

a) There is a difference between defining a function and using a function.

b) There is a difference between a range variable and a vector of data.

c) Functions use argument that can be changed when you use the function, and can contain variables that are defined previously and change outside the function.

d) You can't plot a function name.

e) You can use expressions as input to a graph that use defined functions.

Please review the file to understand the above. Shown you how to get a basic 3D plot of your "sys1" variable. Once you understand this file use the CreateMesh() function recommended by others.

Cheers

Terry.

Martin, in case you are still with us and prefer a simpler variant, see attached. I tried to stay close to what you tried but you should keep in mind that you may have better control using methods like CreateMesh() as shown by Andy.

You can "plot a function name" and in fact in 3D-plots you must use the function name alone without any parameters to make the plot work. But to plot a surfcace in a 3D plot, you must use a function in two variables. So your function sys1() (and also Wk()) must be (and are) dependend on omega AND T.

If you fix this you can plot your surface exactly as you tried. You don't need any range variables (they won't help here anyway), but you must set the range for the two parameters in the plot format menu, tab QuickPlot data. Here you set start, end value and grid number similar to the parameters of createmesh(), but you are not allowed to use variables here, so createmesh() may have its merits. The default range for those parameters includes zero and that the reason you get an error (divide by zero) unless you change the plot range.

The look of your surface may change significantly if you change the grid size only slighty. This is due to the nature of your function. E.g. you have poles for every omega being an integer multiple of 2*pi/T and depending how close a grid point comes to this value you may see a more or less distinct peak. And playing around with the grid size and/or the range for omega and T is much easier with Createmesh() than doing it in the format menu. So I'd prefer the way Andy had shown.

01.02.png

Top Tags