mehdibgh

235 Reputation

6 Badges

6 years, 149 days

MaplePrimes Activity


These are questions asked by mehdibgh

I want to import a numeric 2800*1 matrix from matlab to maple by following command, but faced error as bellow:

X := ImportMatrix("E:/.../Omega.mat", source = MATLAB);
 ImportMatrix:-ModuleApply called with arguments: E:/.../Omega.mat, datatype = auto, delimiter = (), format = (), mode = (), output = all, ragged = true, skiplines = 0, source = MATLAB, sourceid = all, transpose = false
 #(ImportMatrix:-ModuleApply,36): error
Error, (in ImportMatrix) Array index out of range
 locals defined as: file = E:/.../Omega.mat, src = Matlab, ext = ext, res = res, x = x, isv7 = isv7, del = false

Where is the problem?

How to import?

Any comment, idea or innovation to calculate this parametric integral?

Note M, II, JJ are arbitrary positive integers (0<M, II, JJ<11).

F must be a function of Pm at the final!

``

restart

M := 3:

JJ := 5

II := 5

with(ArrayTools):

W := RandomArray(II, JJ, M):

V := ArrayTools:-RandomArray(II, JJ, M):

w := add(add(add(W[i, j, m]*LegendreP(i-1, x)*LegendreP(j-1, y)*p[m], i = 1 .. II), j = 1 .. JJ), m = 1 .. M):

v := add(add(add(V[i, j, m]*LegendreP(i-1, x)*LegendreP(j-1, y)*p[m], i = 1 .. II), j = 1 .. JJ), m = 1 .. M):

L := add(add((LegendreP(i-1, x)*LegendreP(j-1, y))^2, i = 1 .. II), j = 1 .. JJ):

H := 1+tanh(w-v)

F := int(H*L, [y = -1 .. 1, x = -1 .. 1])

Warning,  computation interrupted

 

``

``

Download integralproblem.mw

Why I get "Error, invalid subscript selector" error in my code?

y1 := Grid:-Seq(UP1(s, U, V, W, Phi, Xi, N, a, b, II, JJ, A, B, Dd, M, Ns), s = 1 .. 7);
UKt := add(y1[i], i = 1 .. 7);

Error, invalid subscript selector

As you can see y1 is defined without any problem and have 7 seqments, but the next line warns invalid subscript selector.

What is the best and accurate way to export a large symbolic matrix (200*300) from Maple to Matlab? The Marix have a lot of variables, symbols and operators such as diiff, int, ....

Here is a simple example:

NULL

restart

NULL

A := Matrix(2, 6, {(1, 1) = x*y*z, (1, 2) = (1/2)*tau[2], (1, 3) = sin(x*y*z), (1, 4) = ln(x*y*z), (1, 5) = tau[1]*exp(x*y*z), (1, 6) = sin(x+y)+cos(x+y), (2, 1) = x^2+1, (2, 2) = x^2+1/sin(x*y*z), (2, 3) = 2*exp(y), (2, 4) = tau[1], (2, 5) = diff(f(x, y, z), x), (2, 6) = int(f(x, y, z), x)})

A := 1/sin(protected)

(1)

``

CodeGeneration[Matlab](codegen[makeproc](A, [x, y, tau[1], tau[2]]))

Error, (in codegen/makeproc) optional arguments must be equations [x, y, tau[1], tau[2]]

 

``

``

``

``

``

``

Download export.mw

Where is the problem within this procedure which I can not get the numerical values of V[1] , V[2], ...

restart

A := Matrix([[2*t, 2, 3], [4, 5*t, 6], [7, 8*t, 9]])

A := Matrix(3, 3, {(1, 1) = 2*t, (1, 2) = 2, (1, 3) = 3, (2, 1) = 4, (2, 2) = 5*t, (2, 3) = 6, (3, 1) = 7, (3, 2) = 8*t, (3, 3) = 9})

(1)

B := LinearAlgebra:-Transpose(Matrix([t, 2*t, 3*t]))

B := Matrix(3, 1, {(1, 1) = t, (2, 1) = 2*t, (3, 1) = 3*t})

(2)

``

test:=proc(n)
  local s,t,M,V;
  s:=1:
  for t from 1 to n do
    M:=A+A^(-1);
    V[s]:=(M.B):
    s:=s+1:
  end do;
  V;
end proc:

``

test(4)

V

(3)

V[1]

V[1]

(4)

``

``

Download ProcPropl.mw

1 2 3 4 5 6 7 Last Page 1 of 17