Valerie

132 Reputation

6 Badges

5 years, 356 days
I am a front end developer here at Maplesoft working on Maple Learn and the Maple Calculator.

MaplePrimes Activity


These are answers submitted by Valerie

I don't believe that you can define the size of the plot in cm, but you can define it in pixels using:

size=[x,y]


To make the plot a frame and mesh you can use:

style=wireframe

For the thickness of the frame use:

axis=[thickness=0.5]

For the density of the mesh you can change the value using numpoints:

numpoints=5000

This won't be exact to the pt like you're looking for however.

For the thickness of the plot use:

thickness=1

You can change the axis names font and size using.

labelfont=[Times,Roman,10]


For example:

plot3d( sin(x)+cos(y), x=-Pi..Pi, y=-Pi..Pi, style=wireframe, axis=[thickness=0.5], thickness=1, labelfont=[Times,Roman,10], numpoints=5000, size=[500,500] );


I hope this helps as a starting point.

 

I'm not an expert on this but my best guess is that the problem may be that without having some constant block input, the model as-is has no initial condition for starting the signal from the >= block or similar blocks.

The flange that the sensor is connected to is the rotation of the joint.

Since there is no initial signal there's no rotation and no feedback signal. If you instead connect the sensor for this and similar flanges to the Inertial reference flange the model runs completely, (though I'm unsure if the output is what you're looking for).

To_Box_5_error_edit.msim

Plotting commands have an axis argument that can take subarguments. In your case one way to do this would be with 

dataplot([1, 2, 3], [1, 5, 10], axis = [mode = log]);

if you want both axis to have log scalling.

 

If you want just one of them to then use one of:

dataplot([1, 2, 3], [1, 5, 10], axis[1] = [mode = log]);

dataplot([1, 2, 3], [1, 5, 10], axis[2] = [mode = log]);

 

The login used for the Maple Calculator is the same as the one you used to login to Maple Primes (as well as Maple Cloud). The app is free so it won't require the key you use for Maple.

You can connect the App to Maple through the Maple Cloud by uploading your Math from the App to the Cloud, then downloading it from the Cloud to Maple.

@amandaandi 

If you want to be able to have your anti-virus enabled at the same time you can add the Maple folder to your anti-virus exception list:
 

For Windows and Maple 2020 the Maple folder is:

C:\Program Files\Maple 2020

Alternatively, you can add the following key files:

C:\Program Files\Maple 2020\bin.X86_64_WINDOWS\cmaple.exe
C:\Program Files\Maple 2020\bin.X86_64_WINDOWS\maplelauncher.exe
C:\Program Files\Maple 2020\bin.X86_64_WINDOWS\maplew.exe
C:\Program Files\Maple 2020\bin.X86_64_WINDOWS\mserver.exe
C:\Program Files\Maple 2020\jre\bin\javaw.exe

 

Would you be able to let us know which anti-virus it is (or e-mail support@maplesoft.com )? We can have someone reach out to add Maple to the default allow list.

If you replace the last two lines of your code with

A := GenerateMatrix(sys, [x[1], x[2], lambda[1], lambda[2]]);
Y := LeastSquares(A);

then it will produce the least squares with b being:

Vector[column](6, [0, 1, 0, 0, 0, 0])

also stored in the variable A.

You could also do

A,b := GenerateMatrix(sys, [x[1], x[2], lambda[1], lambda[2]]);
Y := LeastSquares(A,b);

to store them in seperate variables.

 

The four lines after restart can also all be replaced by

with(Student[LinearAlgebra]);

to get all the commands from the Student LinearAlgebra package, or just

with(LinearAlgebra);

for the regular LinearAlgebra package.

You should be able to find a download link for Maple in the e-mail we send out that starts with "Information about your Maplesoft Entitlement".

This e-mail will be good for a limited number of downloads but will allow you to download the installer to distribute it.

If you've used all the downloads or can't find the e-mail you can e-mail support@maplesoft.com (with an address that uses the school domain) and we'll send you a new link.

Alternatively if you have your purchase code handy you can get your download link by entering it here:

https://www.maplesoft.com/download/

 

You can find the derivative of a function using the diff command. You can find the syntax for it by entering

?diff

into Maple, or from the online help here.

diff(sin(x),x)

is given as one of the examples.

 

To plot that you just use the plot command (see ?plot for the help page).

 

You can assign the value of the resulting derivative using colon equals := . For example

eq:=x;
plot(eq,x);

as well you could define it as a function.

f:=x-> x^2;
plot(f(x),x);

 

You can also assign plots to variables;

p1:=plot(f(x),x);
p2:=plot(diff(f(x),x),x);

then using the display command in the plots package to show them on the same plot.

with(plots):
display(p1,p2,color=[red,blue]);

plot_examples.mw

The attached has the code above in a Maple worksheet.

You could probably do something like this using the plot click code.  

To add code that does something when you click a plot you need to insert a plot component from the components palette on the left.

You can set the contents of the plot region using:

with(DocumentTools):
with(plots):
data:=<<1|2>,<3|4>,<5|6>>

p:=pointplot(data,view=[0..6,1..6]):
SetProperty(Plot0,value,p);

To change the click code of the plot click it and select "Edit Click Code" from the context panel. If you add something like

cx:=GetProperty("Plot0",clickx);
cy:=GetProperty("Plot0",clicky);
if cx < 3.5 and cx > 2.5 and cy < 4.5 and cy > 3.5 then
    #Do something;
end if:

 

Then something will be done when you click in the area indicated (cx < 3.5 and cx > 2.5 and cy < 4.5 and cy > 3.5 ) on the plot.

The attached Document hides a plot component when a button is pressed and shows it again when you click on that spot on the plot, (using SetProperty("Plot1",visible,true); ).

I hope this helps you get started.

Plot_Click_Code.mw

If you're clicking and dragging plots from one canvas to another you can only move one at a time.  If you want to display mutliple lines in one plot the easiest way is probably to use plots:-display.

For Example:

with(plots);
with(plottools);
l1 := line([0, 0], [1, 1], color = green);
l2 := line([2, 0], [1, 1], color = blue);
l3 := line([0, 1], [2, 1], color = red);
display(l1, l2, l3);

plots_display.mw

Is this what you're looking to do?

It's not a perfect solution but it may look better if you change the font style set. You can find instructions for this here.

I've attached a worksheet that you can use as a starting point.  With this file you can go to  "Format" > "Manage Style Sets" and skip to step 7 in the instructions linked above.

You can also edit the saved style worksheet in a text editor (such as notepad++), and edit all the fonts and other properties in bulk. The foreground="[r,g,b]" parameter determines the font colour.

High_Contrast_Style_Set.mw

You can use sprintf to format the string to contain 'i'. 
As well you don't need to do a for-while loop, in this case a for loop will work. I also declared 'ourfile' as an Array first as they are more efficient than memory tables if you plan to do a large loop.

restart

n := 5

ourfile := Array(1 .. n)

for i to n do ourfile[i] := sprintf("C:\\Users\\Tamour Zubair\\Desktop\\AA\\T[%g].dat", i) end do

"C:\Users\Tamour Zubair\Desktop\AA\T[5].dat"

(1)

``


 

Download sprintf.mw

There are a few ways you can import figures into Maple, if your figure is stored as data or an image you can try using the import command. The help page for it can be found here.

As well you can go "Insert" > "Image" > "From File" from the menu bar.

Would something like this be what you are looking for?
I have the box as dampers and the vibration as sine wave input. The springs and mass are from the 1D Mechanical library.
Box_with_springs.msim

Page 1 of 1