# Questions tagged [matlab]

Questions related to interoperability between Mathematica and MATLAB.

136 questions
Filter by
Sorted by
Tagged with
44 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 ...
134 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 ...
139 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. ...
36 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 ...
104 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 ...
50 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: <...
265 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 ...
117 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. ...
38 views

### Converting a contour plot in mathematica to a contour plot in matlab

Consider the table f[x_, y_] := x^2 + y^2; tab = ParallelTable[{x, y, f[x, y]}, {x, -5, 5}, {y, -5, 5}]; I can produce a nice contour plot in mathematica by then ...
76 views

### Converting a code with for a loop from MATLAB

In MATLAB I have the following for loop: ...
46 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 ...
695 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 here Product between a column vector ...
531 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 ...
334 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 ...
227 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 ...
64 views

### How to evaluate expressions in Mathematica from MATLAB?

I found a lot of information and examples on how to communicate from Mathematica to Matlab using MATLink, but nothing for the other way around. I would like to use Matlab to send variables and ...
160 views

### Using list of rules from imported .mat file

I'm attempting to learn Mathematica to replace MATLAB. However, I have some data in .mat files which contains named variables. Whenever I import the .mat file, I get a list of rules. What's the best ...
227 views

### Is there a way of reading the data out of a MATLAB's “.fig” file in Mathematica?

I have a ".fig" file from MATLAB that I know is a list of $(x, y)$ coordinates. As far as I know, the ".fig" format stores the data and recreates it every time is opened. I would like to get the ...
179 views

### Native function in Mathematica export functions from Mathematica to MATLAB

Is there any native function in Mathematica (not ToMatlab) that I can export a function from Mathematica to MATLAB, to Paraview or to any plotting software? Clarification: I want to export something ...
476 views

### An efficient way to translate a triple for-loop from Matlab to Mathematica

This is my first post on StackExchange, so if I violate any etiquettes, I apologize in advance. I am a senior engineering student who has been using Mathematica for a year now. For one of my classes, ...
352 views

I am numerically solving the following ODE initially using NDSolve in Mathematica(updated and corrected): $-(-\frac{z'(r)}{r \sqrt{z'(r)^2+1}}-\frac{z''(r)}{\left(z'(r)^2+1\right)^{3/2}})=A_1(z(r)+H)... 1answer 229 views ### Multidimensional MATLAB conversion I try to convert this MATLAB code: From: https://github.com/gpeyre/2013-SIIMS-ot-splitting/blob/master/code/toolbox/%40staggered/interp.m https://github.com/gpeyre/2013-SIIMS-ot-splitting/blob/master/... 3answers 738 views ### Surface plot for matrices (Matlab-Mathematica) Now I am try to convert matlab file to mathematica, This is the original Matlab command, surf, for making surface plots: ... 1answer 81 views ### Drawing a surface using an Excel file I’m totally new to Mathlab. I have the following ‘grid data’ to be read from ‘Office Excel’ that I need them to be drawn as a surface in the Mathematica or Mathlab. I’ve done this with the ‘Surface’ ... 0answers 141 views ### How to automatically load the ToMatlab toolbox when opening the software? [duplicate] I would like to convert the formula to Matlab, but each time I want to run the ToMatlab file, is there any way to automatically load the ToMatlab component when launching the software? 1answer 178 views ### Convert MATLAB Code to Mathematica I have written a MATLAB code as following, in order to calculate an integration involving Modified Bessel Function with variable limits: ... 1answer 123 views ### How can I get rid of extraneous brackets when importing data from MATLAB? [closed] How can I easily correct this data sequence from MATLAB to one readable in Wolfram Mathematica? The problem is the 2 outer brackets: ({{ ... }}) ... 0answers 81 views ### Missing data - reconstructing large gaps with an autoregressive model I am looking for a similar function as fillgaps in Matlab which helps to "replace missing samples in an otherwise uniformly sampled signal by fitting an autoregressive model to the samples surrounding ... 0answers 77 views ### How to call a Matlab user-created function in a .m file from Mathematica? I have a file called gensys.m where it's defined a function gensys, which I would like to call in the mathematica environment and work with it. I've tried to ... 1answer 118 views ### What's the best reference for learning how to best use both Mathematica and MATLAB? [duplicate] I'm pretty good at using MATLAB for a lot of different things, and less familiar with Mathematica, but I just got accepted to a graduate school in mathematics where (from what I can tell so far) some ... 0answers 139 views ### How to efficiently apply PCA followed by SVD to extract the components of PCA? I am working on segmenting a textured image using Gabor Filters. This is based on this paper. There exist a Matlab implementation of this as well. Earlier I managed to do up to this. With the help of ... 0answers 18 views ### Store a value in an element outside of the matrix (as in Matlab) [duplicate] Suppose that I have the matrix A = {{8, 1, 6}, {3, 5, 7}, {4, 9, 2}}; In Matlab/Octave one may store a value in an element outside of the matrix whose size ... 4answers 2k views ### Fast MATLAB, slow Mathematica: Export a matrix as TSV I am trying to find the best way of exporting matrices (results of a time-dependent CFD calculation). I found that .h5 is the fastest option, but h5 is not generic, i.e., I can't really open like a ... 2answers 480 views ### Why the plot of same function is different in Mathematica and MATLAB I need to create a log-log plot of the following function: $$f_k(v)=\frac{v^2\left[v^2/(k-3/2)+1\right]^{-k}\ \Gamma(k+1)}{k\sqrt{\pi(k-3/2)}\ \Gamma(k-1/2)}$$ And the Mathematica code is ... 1answer 1k views ### Converting Matlab code to Mathematica [closed] I have following Matlab code: ... 0answers 61 views ### Vector from Matlab to Mathematica as a function I have a 400x1 vector T in Matlab which is a function of another 400x1 vector E. I have these two vectors. I had a few questions : How do I transfer these two vectors to Mathematica I want to write T ... 2answers 194 views ### MATLAB to Mathematica CorrelationMatrix implementation This question focuses on translating/adapting custom defined MATLAB code for creating a CorrelationMatrix to Mathematica. Software and hardware used: Mathematica Version 10.3.0.0 Computer: Mac Pro (... 1answer 865 views ### Mathematica to Matlab my question is a duplicate of : Is it possible to export the equations from Mathematica to MATLAB? I did some symbolic calculations in Mathematica and want to transfer the result to Matlab. The ... 1answer 694 views ### convert Mathematica expressions to Matlab (ToMatlab and Bessel functions) I have several expressions like the two followings: X11 = I omega rho0 phi HankelH1[m, k0 ra]; X12 = -b1 kp1^2 BesselJ[m, kp1 ra]; I want to covert these ... 1answer 100 views ### Missing _MLDisownDoubleArray from libMLi4.a building MathLink with MEX I'm trying to build MathLink on a Mac using Mex, according to the instructions included in the MathLink download. Unfortunately, when I compile ... 0answers 33 views ### MGet[“var”] returns$failed [duplicate]

I have just completed setup of MATLink for Windows to use with Mathematica 11.1 Student Edition with MATLAB R2017b (not student edition). I have confirmed both are 64 bit mode. I have followed the ...
232 views

### ListContourPlot Interpolation

I plotted a data file with ListContourPlot and I have this result: ...
2k views

### How to mimic MATLAB parula color scheme efficiently? [duplicate]

Does anybody know how to mimic MATLAB's default scheme for DensityPlot, just like this picture shows: update There are several answers already, Thank you very ...
413 views

### qz like function in Mathematica

MATLAB has the function qz() such that [AA, BB, Q, Z, V, W] = qz(A, B) produces matrices V ...
795 views

### Discrepancy between Matlab and Mathematica Fourier parameters [duplicate]

MATLAB and Mathematica have different FFT normalization parameters. This is easy to change in Mathematica with the FourierParameters -> argument, but anything ...
102 views

### Weird plot for the discrete Fourier transform of a normal distribution compared to Matlab

In mathematica, why does Print[ListPlot[Fourier[RandomReal[NormalDistribution[], {100000}]],PlotRange -> All]]; return an empty plot, sometimes with a random ...
87 views

### Mathematica permutes indices when reading Matlab files

I wrote the following Matlab script: ...
101 views

### Convert MATLAB script to find element positions satisfying more criteria

I am new in this community so forgive me if this is a sort of re-post. I am trying to convert this MATLAB script: ...