Message Boards Message Boards

Convert a code to WL

I have a question about to find an easy way for transforming a Matlab type vocabulary into the vocabulary of Mathematica. Maybe you can help me by an example from the book.

Thats how it works on Matlab and Octave:

Command Window:

a = 3;
v0 = 50/3.6;
t = {1, 2, 3}
v = v0 + a*t

by pressing enter it is related to the true function, but by visualization, i have to generate a vector on a graph. I'm sure, that it's very similar but I won't find the true symbolic fields to create that.

here is the example, how it would work on Matlab and also Octave:

Command Window:

t = 0:0.1:5;
v = v0 + a*t;
Plot [t,v,'b']
Axis{[0, 5, 0, 40]}
GridOn
xLabel['t in s']
yLabel['v in m/s']

The "'b'" stands that the graph is blue.

Thanks for any response!

Jias

POSTED BY: Jeremias Söll
4 Replies

It looks easier than it is. It´s pretty hard to find out what the roots are, but if you found out once, then you can work with it. I have a few more examples. https://de.mathworks.com/matlabcentral/fileexchange/74959-live-script-tipler-physik Very well, thank you!

POSTED BY: Jeremias Söll

It´s close, Here is, how it looks like in Octave 5.2enter image description here

POSTED BY: Jeremias Söll
Posted 3 years ago
Plot[v[t], {t, 0, 5},
 PlotRange -> {{0, 5}, {0, 40}}, 
 PlotTheme -> "Detailed",
 FrameLabel -> {"t in s", "v in m/s"},
 PlotLegends -> None,
 AspectRatio -> 4/5]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 3 years ago

Hi Jeremias,

It would help if you posted an image of the plot that is generated by Matlab / Octave. Is this what you are trying to do?

ClearAll@v
a = 3; v0 = 50/3.6;
v[t_] := v0 + a*t
Plot[v[t], {t, 0, 5}, PlotTheme -> "Detailed", FrameLabel -> {"t in s", "v in m/s"}]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract