Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [matlab]

Questions related to creating Mathematica functionality inspired by MATLAB--a proprietary numerical computing environment developed by MathWorks. This includes data import/export and other interoperability questions related to MATLAB programs, scripts, or related software.

1
vote
1answer
26 views

How to write the equation into matrix form

$[(a+k_i)^2+(b+k_j)^2]X_{i,j}-\sum_{m,n}V_{m,n}X_{i-m,j-n}=\mu X_{i,j}$. where $-N<=i,j<=N$ Here we can set $ N=10,a =1, b=1$ and $V_{m,n}$ is the matrix element of $V$. Once I write the ...
4
votes
2answers
121 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 ...
2
votes
0answers
51 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 ...
2
votes
2answers
58 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 ...
3
votes
0answers
86 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 ...
0
votes
1answer
122 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 ...
5
votes
1answer
446 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, ...
4
votes
2answers
250 views

Why does NDSolve blow up when given my ODE but bvp4c in Matlab does not?

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)...
2
votes
1answer
218 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/...
3
votes
3answers
461 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: ...
1
vote
1answer
72 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’ ...
0
votes
0answers
85 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?
1
vote
1answer
118 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: ...
0
votes
1answer
90 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: ({{ ... }}) ...
2
votes
0answers
50 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 ...
2
votes
0answers
45 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 ...
1
vote
1answer
90 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 ...
5
votes
0answers
116 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 ...
0
votes
0answers
16 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 ...
0
votes
0answers
57 views

convert Mathematica expressions comprising greek symbols to Matlab

Is it possible to convert mathematica equations containing greek symbols (symbol manipulation) to Matlab? I found the ToMatlab package, but e.g. the angular frequency (in Mathematica: Esc omega Esc or ...
20
votes
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 ...
0
votes
2answers
305 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 ...
1
vote
1answer
741 views

Converting Matlab code to Mathematica [closed]

I have following Matlab code: ...
0
votes
0answers
46 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 ...
4
votes
2answers
155 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 (...
2
votes
1answer
523 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 ...
3
votes
1answer
402 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 ...
1
vote
1answer
84 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 ...
1
vote
0answers
25 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 ...
2
votes
2answers
136 views

ListContourPlot Interpolation

I plotted a data file with ListContourPlot and I have this result: ...
4
votes
2answers
900 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 ...
5
votes
1answer
162 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 ...
6
votes
1answer
574 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 ...
1
vote
1answer
83 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 ...
2
votes
2answers
75 views

Mathematica permutes indices when reading Matlab files

I wrote the following Matlab script: ...
3
votes
1answer
84 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: ...
3
votes
1answer
90 views

Mathematica bug when reading CDF (Common Data Format) file?

The following Matlab code create_cdf.m: A = reshape(1:32, 8,4); cdfwrite('A.cdf',{'A', A}); A creates ...
2
votes
1answer
254 views

What is the equivalent of MATLAB's accumarray?

Is there any equivalent of MATLAB's accumarray? I'm looking for an equivalent of: accumarray(A(:),B(:),[],@mean) where A and ...
0
votes
0answers
97 views

How to call a mathematica script from a Matlab script?

I need to call a Mathematica script from within a Matlab script and I wonder what is the best way to do so. I've heard about the Mathlink, but no idea how straight forward it is to work with it. I'd ...
0
votes
1answer
385 views

Translate image-processing Matlab code into Mathematica

I need some tips how to translate this Matlab code into Mathematica code. ...
0
votes
0answers
40 views

Problem importing Matlab data

I saved a matlab file with csvwrite command and the import it in mathematica as energ = Import["E.dat"] but then I get as the output: {{0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6} ... Instead of {0.1, ...
3
votes
1answer
422 views

Is there a Mathematica version of ODE tools pplane and dfield?

The toolkits dfield and pplane are staples in ODE courses. First in MATLAB, now in Java. Do they have a Mathematica expression? Sample outputs follow: @Michael E2 Your suggestions were great. Here ...
1
vote
1answer
66 views

Using MATLink with an interactive MATLAB session on MacOS [duplicate]

I just discovered MATLink and it's awesome. The only problem I have is that using OpenMATLAB[] opens a MATLAB session in the ...
0
votes
1answer
104 views

How to get row matrix as an output from a mapped piecewise function? [closed]

I have a piecewise function and want to understand what it is saying. Actually, I have to make a row vector matrix from it. The function is I just want to understand what is saying what will be the ...
0
votes
1answer
404 views

Reordering of columns and rows in a cosine similarity matrix

I have the following 7-by-7 matrix of cosine similarity measures: ...
8
votes
6answers
2k views

How to efficiently input matrices in Mathematica (compared to what MATLAB offers)

Every time I want to manually input a matrix in Mathematica, it takes me a while since every new row has to be in a separate pair of curly braces. For instance: ...
-1
votes
1answer
377 views

Exporting 3D-plot from Mathematica in any file format, and importing to plot with Matlab

I wish to know how I can export a 3D-plot from Mathematica in a file format (e.g. ".dat"), and import it later with Matlab to generate the plot therein. In fact I have successfully achieved the ...
0
votes
1answer
143 views

creating a poly using the rows of a coeffient matrix//translating Matlab to Mathematica [closed]

What I want to do is something similar to polyval in MatLab. I have the MatLab coding, polyval(SM(i,:),x_shift) I know how ...
1
vote
1answer
309 views

Error compiling MATLink on Linux: /bin/ld: cannot find -luuid

Specifically how do you get a successful compilation of mengine? I tried the following: sudo make -f Makefile.lin64 and got the following output: ...
5
votes
3answers
545 views

Mathematica to MATLAB special function translation

I often need to translate results I derive in Mathematica into a MATLAB implementation. These results sometimes involve special functions (e.g. Erfc, ...