# 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

20 views

### How to analyze changes in output plot with variation in input -simulink

I have made a Simulink project. There are multiple inputs and various outputs which are displayed via Scope block.
Now if I change some parameter value like frequency, gain or wind speed etc. I want ...

**0**

votes

**0**answers

7 views

### Matlab 2018b additional configuration steps message while installing?

So, my friend has been trying to install Matlab 2018b and he has encountered the following message just after the installation reaches 100%.
Matlab installation additional configuration steps ...

**1**

vote

**1**answer

41 views

### How to remove the bland space to the left of ylabel in Matlab figure when using long string for ylabel?

I'm doing some plots in Matlab 2014b, in one them I'm plotting 5 variables versus time over there and want to specify 5 names like, speed (rad/sec), voltage (V), ... etc. on the y-label, however, as ...

**0**

votes

**0**answers

9 views

### How to solve two differential equations in MATLAB and plot it? [migrated]

I have two differential equations: da/dt=a(0.3*a^(−3)+.7)^(1/2) and dτ/dt=1/a. The initial conditions are t=0; a=1 and τ=0, respectively (say).
How can I solve the equations in MATLAB? I need to plot ...

**0**

votes

**0**answers

32 views

### How to calculate MGF for a discrete random variable using MATLAB?

I'm already aware of the built-in function that calculates the MGF. What i want is to do so without the moment function and using the standard equation:
$M_x(t) = \sum_{x=0}^{\infty} e^{...

**0**

votes

**0**answers

9 views

### MATLAB r2015b alternative of ureal()

I am using MATLAB R2015b and I need to use uncertain parameter created by ureal() function, which is apparently not available in R2015b version.
Is there any alternative way how to create uncertain ...

**1**

vote

**2**answers

31 views

### To draw x-axis and y-axis, both through origin (MATLAB)

In the following MATLAB plot, I want to draw x-axis and y-axis, both through origin. What would be the easiest code?
x = linspace(-2*pi,2*pi,100);
y1 = sin(x);
y2 = cos(x);
figure
plot(x,y1,x,y2)

**0**

votes

**0**answers

59 views

### MATLAB is selecting SOFTWARE OPENGL rendering

I have installed MATLAB R2018b on Ubuntu 18.04.1 LTS. When I open MATLAB in terminal, I get the following message:
MATLAB is selecting SOFTWARE OPENGL rendering.
Then, MATLAB opens and works. The ...

**0**

votes

**0**answers

15 views

### Estimate density derivative using kernels - Matlab

I am trying to estimate the derivative of the density of random samples in Matlab.
Is there a way to do this without having the write the code from scratch?
I use 'ksdensity' and 'kde' to estimate ...

**0**

votes

**0**answers

19 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

12 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' ...

**0**

votes

**0**answers

12 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

9 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

41 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

188 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

32 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

102 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

52 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

15 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

58 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

17 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

14 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

49 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

21 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

15 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

52 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

115 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

35 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

63 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

50 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

121 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

60 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

57 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

15 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

75 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

86 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

94 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

43 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

64 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

65 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

19 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

14 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

74 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

24 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

61 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 ...