# Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment developed by MathWorks. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend the core capabilities.

**0**

votes

**0**answers

4 views

### MATLAB2018b: Is there a way to enable autoformatting and autocoding for the normal script (not in Live Editor)?

With MATLAB2018b there is the possibility to enable autoformatting and autocoding for Live Editor. Is there a way to enable or configure the same settings even for normal scripts?

**0**

votes

**0**answers

14 views

### MATLAB Non linear optimization of functions in a range of frequencies

I need to optimize the phase difference of two transfer functions, such as:
f = phase(1/(1+tau1*j*w)) - phase(1/(1+tau2*j*w))
The variables to optimize are tau1 and tau2, "j" is the imaginary number ...

**0**

votes

**0**answers

7 views

### VLC does not play back MATLAB generated sub-video

VLC is unable to playback videos that are cropped for ROI (region of interest). Videos are generated by the MATLAB image acquisition tool:
imaqtool
VLC plays the default video resolution (1024x576),...

**0**

votes

**0**answers

7 views

### Expand the Current Folder view to the current file in MATLAB

Is it possible to expand the "Current Folder" view in MATLAB so that the current file in the editor will be visible in folder tree?
So in the above condition if I have a file from the 'AudioVis' ...

**-5**

votes

**0**answers

14 views

### How to do coding for Spatial Perceptual Information Measurement (SI) [closed]

I need help to do coding for Spatial Information on image/video. I know the equation is standardize as this:

**0**

votes

**0**answers

5 views

### How do I create a matrix with real and complex values in Simulink?

I am trying to create the matrix representation for some Quantum gates in MATLAB's Simulink and I am having trouble creating a matrix with complex components.
To create matrices with Real components ...

**0**

votes

**0**answers

4 views

### MATLAB - ODE45 Function

I've recently started using MATLAB and was using the ODE45 function. I have gotten the hang of how to give ODE45 a function, span of t, and an initial value to obtain a graph for the solution of the ...

**1**

vote

**0**answers

19 views

### How to plot an ellipsoid in MATLAB knowing eigenvalues and eigenvectors?

Using
[V,D]=eig(Pmatrix)
I get
V=
0.7107 0.6581 -0.2486
-0.6849 0.7280 -0.0306
-0.1608 -0.1920 -0.9681
D=
103.2955 0 0
0 127.9054 0
0 ...

**1**

vote

**1**answer

187 views

### Matlab ploting in one figure from function

I wrote a function that plot a function y(t) using 4 input argument.
function plot_me_n1(A,B,m1,m2)
t = linspace(0,10,10/0.01);
y=A*exp(-m1*t) - B*exp(-m2*t);
plot(t,y,'color',rand(1,4));
title('...

**0**

votes

**0**answers

8 views

### Out of memory error in Matlab

I'm using Matlab (version R2013b on MacOS 10.13.6), and running into a strange memory error. In particular, I've entered the following sequence of commands
>> A = rand(2);
>> [q,~] = qr(...

**0**

votes

**0**answers

29 views

### Manipulating MATLAB Heatmap Plot Type Colorbar Ticks

I am using MATLAB 2017b. I would like a way to manipulate the tick marks and tick mark labels of the colorbar of the MATLAB heatmap plot type.
Information on the heatmap plot type can be found here ...

**0**

votes

**1**answer

49 views

### Making windows have better names

When I'm programming in Matlab, the scripts that I write all have the directory as part of their name, resulting in it being impossible for me to distinguish them by their names. Here's a picture to ...

**-1**

votes

**1**answer

23 views

### Matlab: Get graphics object's name

Some (graphics) objects in Matlab seem to have "names". For example, if I create a plot plot(1,1) and give it a title title('mytitle') and then access the current axes via gca I get the following ...

**0**

votes

**0**answers

14 views

### Building a partial differential equation by inputting signals f(t)

This is my differential equaion,
dy(1)/dt=y(2)+f(t);
dy(2)/dt=7*(1-y(1)^2)*y(2)-y(1);
where f(t) is a signal wave having trapezoidal form, which is known.
i am familiar with how to build a function ...

**0**

votes

**0**answers

45 views

### Apply deformation field without affecting the intensities

I am working with Volumes (3D matrices), and I have got geometric transformation and displacement fields from the function imregtform. My moving image and fixed image are binary images (0s and 1s). ...

**0**

votes

**0**answers

11 views

### An Issue with Numerical Evaluation of Coverage Probability Using MATLAB

I am trying to numerically evaluate a complicated coverage probability expression via MATLAB using this code:
clc;
clear;
beta_dB=0;
beta=10^(beta_dB/10);
N=50;
ra=4*10^3;
h=120;
alpha=2.5;
m=2;
x0=...

**0**

votes

**0**answers

10 views

### Plotting intermediate variables in ode45 solver in Matlab

I have a system of three differential equations that I define in a user-defined function differential:
function dvdt = differential(t,v)
global rho kappa phi tau xi N1 N2 p b delta alpha mu sigma c_t ...

**0**

votes

**0**answers

46 views

### Simulink conditional breakpoint, find location of the one that triggered

I put conditional breakpoints in my Simulink model but they are in different subsystems. Sometimes my simulation pauses, and I guess it is because a conditional breakpoint triggered. Is there an ...

**1**

vote

**1**answer

86 views

### When ploting 3d scalar field with Matlab, why axis X exchanges with Y?

When I draw the isosurface of a 3d scalar field A(i,j,k) (i=1~31, j=1~151, k=1~151) using Matlab, in the figure, indice j corresponds to X axis, i corresponds to Y axis. How does Matlab arrange 3d ...

**0**

votes

**0**answers

16 views

### Alternative change between controllers in Simulink

Imagine I have a plant model which should be controlled within the time interval [0,T]. I should divide this interval into some equal subintervals. In each subinterval, I have to run one specific ...

**0**

votes

**0**answers

10 views

### How do I get a patch (polygon) on a map to fill on the inside instead of the outside in MATLAB?

I am using the following commands to draw a desired shape (usually a circle) on a map, then fill it in and make the color transparent.
H(ss) = geoshow(lats,lons,'DisplayType','polygon');
H(ss)....

**3**

votes

**1**answer

50 views

### What is the Excel equivalent of Matlab's randn function

The randn function of Matlab generates a random number from the standard normal distribution.
What is the equivalent in Excel?
I think the rand(2)-1 is not the right solution because the random ...

**1**

vote

**1**answer

80 views

### One-liner to sort STRUCT in MATLAB?

Seeking a one-liner MATLAB function / command to sort by date the output of:
filenames = dir(filenameSubstring); % retruns struct
sortrows() is for matrices and seems to rely on the sorting column ...

**0**

votes

**0**answers

33 views

### Write API in MATLAB

Write API in MATLAB
I want to take reading from my Arduino (which I am already doing through MATLAB), and create an API of my readings. This is so I can make an app with Xcode in Swift that can ...

**0**

votes

**0**answers

56 views

### What is the equivalent of ListDensityPlot3D in Matlab?

Mathematica has a nice command called ListDensityPlot3D. Is there an equivalent of this command in Matlab?
So essentially, ListDensityPlot3D takes a data array which generically represents a function ...

**0**

votes

**0**answers

38 views

### Matlab socket data

I met a challenge when using socket connection in MATLAB. I use it to achieve sequential data from a device.
At each time, the device sent a vector as a string (with different length) to MATLAB. I ...

**0**

votes

**1**answer

74 views

### Matlab/Octave Solving Matrix Using Gauss Seidel not Converging

Something totally impossible is happening. I have run the following code multiple times on the same Matrix and always converged to a solution using the Gauss Seidel method within 10 iterations.
My ...

**0**

votes

**0**answers

44 views

### Thermistor to Celsius/Fahrenheit/Kelvin in MATLAB

Thermistor to a Temperature Unit in MATLAB
I am using an Analog Read Pin on an Arduino Uno to read the temperature as given by a thermistor. The resistor being used on the thermistor is 220𝝮. What I ...

**0**

votes

**1**answer

46 views

### MATLAB License error 96

I am trying to open MATLAB on my windows pc. About a week ago it was working fine now i get the 96 error code.
License manager error 96.MAtlab is unable to connect to license server.
I am connected to ...

**0**

votes

**1**answer

14 views

### Export all MATLAB images in one go

Code: https://pastebin.com/6MWsmaJF
Essentially, I've created a function in Matlab which spits out around 200 images.
How do I save all of these images in one go?

**0**

votes

**0**answers

64 views

### Matlab R2016a on Ubuntu 14.04 and JDK 1.7; Needed? Alternatives?

I have already successfully installed Matlab 2016a on Ubuntu 14.04. As the installer finished wrapping up, it notified me that I was missing some necessary compilers. I noticed that I had forgotten to ...

**-1**

votes

**1**answer

65 views

### Stacked Bar Graph in Excel or Matlab

I want to represent this graph either in matlab/excel . X-axis show the load on primary network with values ranging 0.0 to 0.9 At Y-axis there is a ratio of NSU/NCH that goes from 0.08 to 0.44 each ...

**0**

votes

**0**answers

91 views

### MATLAB neural network

I am trying to analyze the follwing code and I am not too familiar with MATLAB.
layers = [ ...
imageInputLayer([1000 1 1])
reluLayer
fullyConnectedLayer(100)
fullyConnectedLayer(100)
...

**0**

votes

**0**answers

33 views

### Mathematica ContourPlot vs. MATLAB fcontour

I'm having a bit of trouble figuring out the best way to create a figure. I'm not familiar with Mathematica, but my advisor quickly created a figure using ContourPlot as follows:
ContourPlot(function,...

**0**

votes

**0**answers

52 views

### How to stop OuterPosition from resetting after Position change in MATLAB figure?

When trying to export a MATLAB chart I adjusted the Position to fit my needs by adding a padding on the left and right equal to the left TightInset and on the top and bottom equal to the bottom ...

**0**

votes

**0**answers

64 views

### Generalising from 2 to N function input arguments

I would like to plot data representing subject-wise scores as beeswarm plots (showing variability across subjects + central tendency e.g. median), while labelling nested levels (groups&subgroups) ...

**0**

votes

**1**answer

36 views

### How can the colors of ones choice be added to the legends manually in an image in MATLAB?

I wish to add the colors to the legends as per the rgb values of the corresponding color in the image. The image can be displayed using the code written below:
x1=ones(30); x2=2*ones(30); x3=3*ones(...

**1**

vote

**1**answer

18 views

### Matlab fprintf function does not create newlines

I tried to remove some lines from a file using following commands.
fData = textread('s0001_rem.hea', '%s','delimiter','\n','whitespace', '');
fData ([20 19 18])=[];
fid=fopen('s0001_rem.hea', 'w');
...

**0**

votes

**0**answers

13 views

### What are the minimum permissions required by Simulink for USB Serial?

SYMPTOM
Simulink crashes when executing a simple model that 'smoke tests' a serial data source:
CONTEXT
Simulink R2017B on OSX
USB Serial device:
Users-MacBook-Air:~ user$ ls -l /dev/ | grep ...

**0**

votes

**0**answers

59 views

### How to rejection sample on matlab?

How can I use matlab to perform rejection sampling on a uniform distribution using rand, to pick 20% of samples in the range 0 to 0.2 and the other 80% between 0.2 and 1?

**1**

vote

**1**answer

21 views

### MatLab: Line break between arguments of a function

When writing a function with arguments in MatLab, can the arguments be separated by a line break in some way (similar to separation by whitespace characters such as space or tab being allowed)? An ...

**0**

votes

**1**answer

55 views

### Colon-generated arrays with or without brackets in Matlab

From what I can tell, the arrays a:d:b and [a:d:b] are exactly the same thing. For example,
>> [1:3] == 1:3
ans =
1×3 logical array
1 1 1
Yet, these two expressions give different ...

**0**

votes

**0**answers

14 views

### How to solve the ascii2fts error in MATLAB?

I anm trying to code macd. I am using ascii2ft and I have a .dat file that has the column names on the first row.
I tried to do this: ssnlf= ascii2fts('ssnlf.dat', 1);
I am getting the error below:
...

**0**

votes

**0**answers

14 views

### Warping MATLAB patch() output to an equation

Plain and simple: I'm trying to warp the output of the well-known usflag function on the Mathworks website, so that rather than being a stiff flag, it conforms to a sine wave (or preferrably any ...

**0**

votes

**1**answer

1k views

### Matlab Hardware OpenGL Failure on Ubuntu 16.04.3 - Can not initialize shared resources

First, my system info:
4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Clean installation of Matlab R2016b (64-bit)
Video card: AMD/ATI Pitcairn ...

**1**

vote

**1**answer

27 views

### Storing the plots in a folder while running the MATLAB program?

In my MATLAB program I have to run a for loop for 500 times and each time the loop runs it plots a graph, so If I run the program there will be 500 (.fig files) and that may hang my system.
So is ...

**0**

votes

**0**answers

153 views

### How do I export a MATLAB Live Script as a landscape PDF?

Is it possible to configure MATLAB's Live Script function LIVE EDITOR > Save > Export to PDF... to export as an A4 landscape oriented PDF?
Presently when I export to PDF from a Live Script the ...

**0**

votes

**1**answer

48 views

### Matlab, fimplicit, how to show a specified region on graph using an inequality

I am using fimplicit command to produce a graph, but i have a condition x+y<=1, and I want only that region of the graph to be shown.
Example:
f = @(x,y) x.^2 + y.^2 - 3;
fimplicit(f,[-3 3 -2 2])
...

**1**

vote

**0**answers

18 views

### matlab symbolic equality wrong

Why does matlab return a zero instead of a 1 for this command
isequal(3*sin(x1)*M+3*sin(x1)*m,3*sin(x1)*(M+m))
similarly it returns a zero if I do
isequal(3*sin(x1)*M+3*sin(x1)*m,simplify(3*sin(x1)...

**0**

votes

**0**answers

43 views

### Variable diffusion coefficients in matlab

I'm running out of time for this code so any help would be greatly appreciated. I am currently coding the 2D heat/diffusion equation in matlab . my equation looks like this:
∂u∂t=αx∂2u∂x2+αy∂2u∂y2+Au(...