Jump to content

Math Script octave differences.


Taylorh140

Recommended Posts

I was working on octave with a simple script:

im=[3.5 ;3.5 ;3.5]
ip=[1/3 ;2/3 ;3/3]*2*pi
w=2*pi*15 % 15Hz signal
dt=0.0005;

t=0:dt:0.05;
th=w.*t;

i=im.*(sin(th+ip));  % generate abc

to generate 3 sinusoids offset by 120 degrees.

However Mathscript seems to choke on (th+ip)

I'm not actually sure what operation is happening or rather octave has some type of extension to the addition operation.

I like the convenience of the above method. but I can't figure out how to do the same thing in mathscript without a for loop. 

Link to post

So this apparently is the same with MATLAB:

https://www.mathworks.com/help/matlab/ref/plus.html

In the section:

Add Row and Column Vectors

a = 1:2;
b = (1:3)';
a + b

This simple code will not compile in Mathscript :(

its the same story with

Add Vector to Matrix

It's just a seemingly basic incompatibility and it seems it has something to do with how vectors are handled in basic operations.

unless there is some super secret setting to make these compatible ill just have to find a workaround.

 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.