Skip to main content

Questions tagged [matlab]

Questions related to interoperability between Mathematica and MATLAB, or implementation of MATLAB functionality in Mathematica. This tag is NOT for pure MATLAB question.

Filter by
Sorted by
Tagged with
0 votes
1 answer
85 views

How can I transpose SCILAB/MATLAB code with for loop into Mathematica? [closed]

How can I transpose the following SCILAB/MATLAB code into MATHEMATICA? I took a look at similar questions, but none of them seemed to provide a solution. ...
Pascal77's user avatar
2 votes
1 answer
92 views

Adding Greek letters to ToMatlab

I want to add Greek letters to the ToMatlab package. The most recent publicly available version I found is here. There is a section on symbols starting on line 242. I tried adding a line ...
Roy's user avatar
  • 101
1 vote
0 answers
43 views

Why my MATLink must execute the command `OpenMATLAB[]` twice to realize once normal `OpenMATLAB[]` command?

Problem description To use Matlab code in Mathematica I have tried to use the package MATLink. However, everytime I run the code below ...
narip's user avatar
  • 381
4 votes
1 answer
99 views

How to use a personal function in Matlab within Mathematica utilizing Matlink?

Problem description I've written a function in Matlab as follows: function z = testfuncadd(x,y) z = x + y; end I want to use this function within Mathematica ...
narip's user avatar
  • 381
1 vote
0 answers
190 views

Bifurcation and stability analyses of delay differential equations

Are there any packages in Mathematica for bifurcation and stability analyses of delay differential equations? For Matlab, there is a nice tool like: https://twr.cs.kuleuven.be/research/software/delay/...
user avatar
6 votes
2 answers
686 views

Convert MATLAB code solving 1D wave equation via FFT using ode45 into Mathematica code

I don't quite understand the process of solving differential equations by MATLAB. It seems that it doesn't need the explicit function to specify the required solution, but only needs to input the ...
mozeq's user avatar
  • 295
1 vote
1 answer
170 views

How to convert the Mathematica matrix to MATLAB format and using MATLAB to verify the solution?

I have got the solution of the matrix system and get the solution using LinearSolve, and now I want to use MATLAB to see whether it can generate the same solution, ...
fhrl's user avatar
  • 129
6 votes
0 answers
719 views

Code for quasi 1D nozzle flows

The quasi-one-dimensional model describing the flow of compressible gas in rocket nozzles is very common. The corresponding equations have a divergent non dimensional form $ \frac{\partial \mathbf{U}}...
Alex Trounev's user avatar
  • 45.6k
1 vote
0 answers
104 views

Matlab to Mathematica code to solve system of ODEs [closed]

I have the following system of second order non-homogeneous DEs: \begin{align} 0 &= 2 x_t - J_{\pi_t}(x_t) \frac{\epsilon - 1}{\theta} (1 + \varphi) + \frac{\partial J_{x_t}(x_t)}{\partial x_t} \...
NC520's user avatar
  • 479
3 votes
2 answers
297 views

Givens rotation: What is the Mathematica equivalent to MATLAB's planerot function?

Matlab has a function called planerot which takes a two-component column vector $x$ as input and returns a $2 \times 2$ matrix $G$ and a two component column vector ...
noir1993's user avatar
  • 303
4 votes
1 answer
206 views

How to export a matrix with complex entries having arbitrary precision from Mathematica to Matlab?

I am trying to export a large matrix with complex entires having arbitrary precision (~ roughly 200 digits after the decimal point) from Mathematica to Matlab. I have used ...
noir1993's user avatar
  • 303
1 vote
1 answer
155 views

What's the difference between FourierDCT and dct2 in matlab

...
HyperGroups's user avatar
  • 8,619
0 votes
0 answers
95 views

An Error in `MATLink`

I downloaded MATLink to the directory generated by the command: (Matlab 2022b and Mathematica 13.1 on windows 10) ...
RF_1's user avatar
  • 672
1 vote
1 answer
220 views

Convert Matlab code for Fourier transform equivalently into Mathematica

I have a Matlab-style code that uses Fourier transform efficiently. Here is the function which defines a differentiation matrix D, where ...
user95273's user avatar
  • 135
0 votes
1 answer
152 views

Exporting a list to Matlab

I have some parameters. parameters = {c -> 1, d -> 1, e -> 2, f -> 1} I want to export them to Matlab using ToMatlab...
RF_1's user avatar
  • 672
7 votes
4 answers
1k views

Implementation of MATLAB's "numgrid" function [closed]

I am looking for an implementation of MATLAB's numgrid function, in particular the "B" mode. For example, I want to get the matrix corresponding to the ...
Yaroslav Bulatov's user avatar
1 vote
0 answers
51 views

Using `GradientFilter[]` and `GradientOrientationFilter[]` to reproduce Matlab's `gradient()` function

In 'gradient' function in MMA, two methods are given to reproduce Matlab's gradient() function. I thought that ...
ZachB's user avatar
  • 1,200
5 votes
1 answer
226 views

Use function defined in Mathematica from Matlab

This question is the same as this post which was closed too early to be answered and efforts to reopen it were unsuccessful. How could we use a defined function inside Mathematica from Matlab? With ...
Ben Izd's user avatar
  • 9,319
2 votes
0 answers
203 views

Call function defined in Mathematica from Matlab [closed]

Is it possible to call a defined function inside Mathematica like InterpolationFunction[...] from Matlab? Thanks!
Ulrich Neumann's user avatar
0 votes
1 answer
168 views

Cannot open MATLAB from MATHEMATICA

I am using MATLAB R18 and MATHEMATICA 12. I downloaded MATlink to the directory generated by the command: ...
Md Salem's user avatar
6 votes
2 answers
478 views

Compare MMA program with MATLAB program by plotting the same equation

Cross-posted in Wolfram Community. Firstly, the MATLAB program is ...
InFei's user avatar
  • 115
0 votes
0 answers
86 views

Surface crossing itself plotted from x,y,z data

In Matlab I am generating this surface for example. It is plotted in for loop, so in each iteration I plot one ellipse or whatever itself crossing curve. Number of iteration is high so it produce ...
struct's user avatar
  • 121
7 votes
1 answer
1k views

How can I generate the same random number in Mathematica and MATLAB?

As a part of my research studies, I have developed a code which is essentially based on random generation of numbers. The first version of the code was written in MATLAB, however, for some reasons I ...
KratosMath's user avatar
  • 1,287
1 vote
1 answer
455 views

How to express number in exponential decimal such as 1e2=100?

I am using MATLAB for a long time, and usually I express the number as exponential decimal such as x = 1e2; % x=100 However, if I write this form in mathematica, ...
Juno's user avatar
  • 13
2 votes
1 answer
157 views

Matlab code to Mathematica, Tensor

I am trying to convert a Matlab code to Mathematica. I have a tensor, RF (a,b,c,d) which is constructed from Hamiltonian (Hs) and 2x2 identity matrix (DS): ...
Aman's user avatar
  • 149
0 votes
1 answer
164 views

Implementing an optimization algorithm in WL

I am trying to implement the Jaya optimization algorithm (Jaya). This is a flowchart from the Author 's webpage showing the details of the Algorithm. Note that there is a typo in the equation in the ...
Mahamed Omran's user avatar
1 vote
1 answer
245 views

'quiver' function in MMA (quiver(x,y,u,v))

How to calculate Quiver using the "quiver function" ("Matlab-like")? quiver(x,y,u,v) plots vectors as arrows at the coordinates specified in each corresponding pair of elements in ...
ABCDEMMM's user avatar
  • 1,816
5 votes
2 answers
817 views

'gradient' function in MMA

How to calculate Numerical gradient of 2D arrays using the "gradient function" ("Matlab-like")? "[___] = gradient(F,hx,hy,...,hN) specifies N spacing parameters for the ...
ABCDEMMM's user avatar
  • 1,816
2 votes
1 answer
288 views

Create a matrix without definition of dimensions

is it possible to define a matrix without giving its dimensions in Mathematica, e.g. First line: mattest[[1,2]] = 1; Second line: ...
ABCDEMMM's user avatar
  • 1,816
1 vote
1 answer
235 views

ListContourPlot in Mathematica

I tried to plot the following curves in Mathematica using "ListContourPlot" , and compared them with the results from Matlab 2019a. Mathematica code: (cite from Reference (1)) ...
ABCDEMMM's user avatar
  • 1,816
2 votes
1 answer
333 views

Diagonal matrix command in Mathematica

How to find the corresponding Mathematica commands for diagonal matrix operation in Matlab, e.g. AA=rand(3,3); Step 1.) finding the diagonal elements, and export ...
ABCDEMMM's user avatar
  • 1,816
-3 votes
1 answer
461 views

Need help to convert a Matlab script into a Mathematica script?

I would like to convert a small script but a little technical in Mathematica language. Here is the Matlab script : ...
youpilat13's user avatar
1 vote
0 answers
280 views

Import matlab MAT-format fails

As I did many times before, after updating Mathematica v12.2 I have problem to import matlab *.mat file: I checked ...
Ulrich Neumann's user avatar
5 votes
1 answer
139 views

How to determine the file type of a .m file?

Both Mathematica and MATLAB widely uses .m files, but with diametrically different syntaxes and usage. Currently WRI is moving towards the ...
Gravifer's user avatar
  • 872
12 votes
2 answers
745 views

InverseRadon behaves differently from iradon of MATLAB

I have to calculate a 2-dimensional radially symmetric distribution from a single projection. I know that InverseRadon should actually do the job, but I get the ...
Quit007's user avatar
  • 1,255
5 votes
3 answers
817 views

Changing value of specific element in an array. (Converting code from MATLAB to Mathematica)

Can we change the value of a specific element of an array in Mathematica? Basically, I have the following given MATLAB script which writes a big 3N-by-3N matrix $h$ by combining two 3-by-3 matrices $...
Luqman Saleem's user avatar
0 votes
0 answers
99 views

Is it possible to implement this Matlab code for the normal form of a bipartite operator in Mathematica?

I am interested in converting the $16 \times 16$ ("density") matrix ...
Paul B. Slater's user avatar
1 vote
1 answer
70 views

Create table A with entries of the form Ai_j

I would like to create an $m \times n$-table A with entries Ai_j, where $1 \leq i \leq m$ and $1 \leq j \leq n$. I have seen ...
Bipolar Minds's user avatar
4 votes
1 answer
300 views

Matlab Code and Mathematica Code both identical with different results [closed]

I have spent so much time working around with this code to give the same identical answer as the code I have written before over Matlab. I am just trying to switch towards using Mathematica in my ...
A Qoutb's user avatar
  • 77
6 votes
1 answer
553 views

Different results using spline interpolation in Wolfram and MATLAB

I use the same data for interpolation in Mathematica and MATLAB, but the result is different. ...
srtie's user avatar
  • 63
0 votes
1 answer
114 views

How to discritize a function domain (break xy-plane to a grid/mesh of squares with vertex values for evaluation)? [closed]

I wrote a code using MATLAB to discritize a function's 2D domain into squares/rectangles, whose vertex data (x,y) I can use to evaluate the function at. Then I sum these values over all vertices to ...
TribalChief's user avatar
1 vote
0 answers
233 views

Mathematica to Matlab (not "so easy" code) [closed]

Based on a Wolfram Demonstration of the Ising ferromagnet using Monte-Carlo Metropolis, I modified it a bit to the anti-ferromagnet case and to get the plot of the order parameters as a function of ...
Daniel Castro's user avatar
2 votes
1 answer
257 views

Problem in setting up MATlink

I am trying to set up a MATlink using the instructions given here. I get an error while running the following commands Needs["MATLink`"] OpenMATLAB[] Error: <...
Natasha's user avatar
  • 359
10 votes
1 answer
943 views

Moving B.C.s in heat diffusion model

I came across the paper Solidification dynamics of an impacted drop regarding a heat equations by Thiévenaz et.al and was interested in knowing how they obtained the graphs presented. From what I ...
DMH16's user avatar
  • 409
0 votes
1 answer
146 views

How can I convert my MATLAB code into WL code?

I am working in MATLAB and want to convert the following snippet into WL code to run on Mathematica. ...
DisPxy's user avatar
  • 101
2 votes
1 answer
65 views

How to import a matrix of integers from MATLAB?

I am importing a matrix from MATLAB. However, there are some redundant items added in the imported matrix. For example, the imported matrix is a binary matrix. After import, it looks like this ...
MGK's user avatar
  • 565
12 votes
1 answer
2k views

Row vectors and column vectors (Mathematica vs. MATLAB)

As far as I know, Mathematica does not distinguish between row vectors and column vectors: all vectors are seen as lists. I know ways to bypass this as suggested in Product between a column vector and ...
Dimitris's user avatar
  • 4,824
6 votes
1 answer
1k views

Frequency Response

How to plot frequency response which includes magnitude response and phase response of a transfer function in Mathematica? In Matlab, we can use [h,k]=freqz(b, a, N); to generate magnitude response ...
Ajay Dyavathi's user avatar
2 votes
1 answer
466 views

Analog of MATLAB's conv2 in Mathematica?

I have a matlab code filter = 1; F = conv2(double([1 2 1]),double([1 2 1]'))/16; for i=1:some_integer filter = conv2(double(filter),double(F)); end In the ...
Ali Hashmi's user avatar
  • 8,960
6 votes
2 answers
420 views

Simulating ndgrid function of MATLAB

I know that there has been an answer on meshgrid function of MATLAB. For functions involving more than 3 variables, this function does not work. In MATLAB, the ...
exp ikx's user avatar
  • 768