Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. Questions should be tagged with either [matlab] or [octave], but not both, unless the question explicitly involves both packages. When using this tag, please ...

0
votes
1answer
14 views

Efficient way to apply highpass to 1D signal in 2D matrix

I have a very huge array, and each column is a different signal, is there a way to do this efficiently without using looping as below? in_data=rand(2000,100000); for j=1:size(in_data,2) in_data(:...
1
vote
1answer
25 views

How to know the value of indices using find function?

I have a 4096x2 matrix called datos1. I'm trying to plot from its highest value with [valor_maximo, canal_maximo]=max(datos1(:,2)); to a percentage given (5% of the highest value) with conteomin=...
0
votes
0answers
19 views

MATLAB parfor doesn't speed up any of my array operations.

I have been trying to optimize my to compute array operations in Matlab using parfor, however, when I tried using par for on the outer loop (v loop) the runtime increased significantly due to the ...
1
vote
0answers
17 views

Matlab code generation of resample: the number of terms N must be constant

I use Matlab coder to generate C code of the following function: function [out] = myresample(in) out = resample(in,4644,1000,10); end and generate the code by codegen myresample -args {coder....
-1
votes
0answers
19 views

Faster version of matlab's besselj function?

I have code that is computing besselJ function multiple times and I was wondering if there was a function/implementation of the Bessel Function of the first kind order 0, 1, 2, ... so on that was ...
0
votes
1answer
24 views

Running 3 for loops in parallel in Matlab

I have three mobile operators O1,O2, and O3, each of them has its own mobile ( N_M_O1,N_M_O2, and N_M_O3) they are sharing the base stations (B1 and B2) represented by (conter_B1,conter_B2) I need to ...
0
votes
0answers
7 views

Is there a way to plot a reference vector from a subplot in the overall figure?

I have nine plots within the same figure that contain wind vectors and some contoured values. I am able to plot the colorbar to the right of the figure without issue, but I need to find a way to put a ...
-1
votes
1answer
20 views

Increase the imaginary part of complex number by a constant in matlab

I think this is a simple question, but I could not find an answer by googling. Let's say that I have a code like this: y1=1:0.01:2; This creates 1x101 long cell, with numbers 1, 1.01, 1.02, 1.03, 1....
0
votes
0answers
13 views

how to fit a complex model to complex data

I don't know which fit routine I should use, which one is the best. I got a 2dimensional complex field (measurement data, about 300x400 pixel) and I like to fit a model with 6 degrees of freedom (6 ...
0
votes
1answer
20 views

MATLAB function errors with no solution

Today in my Uni course I've got a problem and the proposed solution was this one (with slight modifications made by me). But it has more errors than my actual solution, what is wrong with it? Here is ...
0
votes
1answer
49 views

vector<vector<double>> to mxArray using memcpy

I have correlation matrix of a data and i want to use pca to transform them to uncorrelated set. so i've decided to use matlab engine(c++ mex API) to perform the pca my question is how to copy the ...
0
votes
0answers
18 views

Computing the DFT of an arbitrary signal

As part of a course in signal processing at university, we have been asked to write an algorithm in Matlab to calculate the single sided spectrum of our signal using DFT, without using the fft() ...
0
votes
0answers
10 views

How to average with nlfilter?

I'm trying to average over a sliding window using nlfilter but the image keeps showing up as blank. This is my code. B = nlfilter(graydog,[3 3],@(x) round(mean(x(:)))); Any ideas?
0
votes
0answers
24 views

recursive tree parsing in matlab

I have a map, where my keys are parents and the respective values are the children of said parents. This map can extend to an n-depth if necessary. The map looks like: K>> obj.hierarchy ans = ...
0
votes
0answers
9 views

Alternative to vpasolve and results arrangment

I'm triying to solve the following problem in Matlab: I have two known matrices F and Q mxm (m=20), and I want to find a matrix L that satisfies the equation F-(QL+LQ)/2 = 0 (I know it is a ...
-5
votes
0answers
57 views

Changing a C++ loop for Matlab [on hold]

Ok, then. Would someone help me rewrite this C++ snipped code into a Matlab code? Mainly the nested loop for that I cant use negative values inside it in Matlab. int WIN = 5 double norm = (double) 1/...
0
votes
0answers
13 views

Using solve to find two variables in a single nonlinear equation

I am trying to use solve in Matlab 2016b to find two variables in an equation, where the remaining values have been specified. syms S0 alpha eqn=S0*((1-exp(-TR/T1))*sin(alpha)/(1-cos(alpha)*exp(-TR/...
-3
votes
1answer
22 views

Neural networks for an imbalanced dataset

I have a very imbalanced dataset consisting of 186219 rows of data by 6 dimensions including 132 true positives against 186087 false positives, what types of neural network would you recommend to try? ...
0
votes
0answers
16 views

Matlab make plot3 look like surface plot

I have 3 vectors x, y and z. I am able to plot these points with plot3 however I want it to be more fancy and filled with colors like how plots look 3 dimensional with surf. Actually, my aim was for ...
-1
votes
0answers
7 views

hessian-affine feature detection+ SIFT in MATLAB

I'm working on image retrieval in large datasets with VLAD in MATLAB on Holidays dataset(reference article is "Aggregating local descriptors into a compact image representation Hervé Jégou, Matthijs ...
0
votes
2answers
21 views

Import multiple tables in MATLAB

I need to import many tables (.xlsx format) in MATLAB. I hence tried to do so with a for loop. The code is reported below: addpath('C:\...'); % here hide the actual path just for simplicity ...
4
votes
1answer
37 views

How do I remove specific uicontextmenu options in MATLAB (e.g. in the legend's menu)

So, I have a legend (on a plot) in an application I'm working on. If you right click on it a bunch of optional actions come up. These include things like 'Interpreter', 'Location', 'Orientation', etc.....
1
vote
1answer
34 views

Creating a point moving along a graph in MATLAB animation

I am looking to create 2 dots which move along 2 graphs within MATLAB in which the model shows the point moving along the curve with time. I know there has been ask a similar question here, but it ...
-4
votes
0answers
28 views

Finding the minimums and maximums of a signal in matlab

I am trying to find all the maxima and minima of a signal in MATLAB without using findpeaks. I do not really have any idea of what can be done. These are the signals. How can I determine the peaks ...
0
votes
1answer
33 views

How to build filenames in a nested loop

I am trying to access 4k images and crop some ROI based areas (4 ROI in my case) and store them in some directory. So far everything is working okay except the loops handling of the filename. Below ...
0
votes
0answers
23 views

Mysterious peaks (tones) on biosignal spectrum (FFT) [on hold]

We are doing electrmyography signal acquisition in the Hospital. Sampling Frequency: 2048 Hz using a Biosemi acquisition system. No filters applied be sides the anti-alias default of the system. I can ...
0
votes
1answer
26 views

What do the Contour Levels Produced by Matlab Function Contourc Represent

I have been trying to understand what the contour levels are. As far as I understand a contour of the function Z(x,y) is a set of points in the (x,y) plane, such that Z(x,y) is fixed at some constant ...
0
votes
0answers
40 views

Calculate average size of bubbles on plenty of pictures

I have pictures like this: There are around 100 pictures, they differ from each other by diameters of black bubbles. I need to calculate the average diameter of bubbles on every picture. So, in the ...
-1
votes
0answers
20 views

How to get height and width of region enclosed in the boundaries for use with bwboundaries?

clc; clear; I = imread('../demo.jpg'); imshow(I) grayImage = rgb2gray(I); BW = im2bw(I); imshow(BW) hold on; boundaries = bwboundaries(BW);[enter image description here][1] fprintf('length values is = ...
0
votes
1answer
37 views

MATLAB plot: automatically using a column variable (Name) as Display Name in the legend

So I have a series of temperature loggers which all have a specific name and I want to plot them as follows: Now, as you can see in the example plot I added, the legend automatically labels the lines ...
1
vote
1answer
22 views

What is titanium in the example on fitting a Gaussian model?

In the documentation on fit, the Gaussian model was created by: [x,y] = titanium; f = fit(x.',y.','gauss2'); plot(f,x,y) I was wondering what is titanium? I can't find any relevant explanation to ...
-2
votes
1answer
36 views

Matlab string variable

I am having a problem with this question: I have written a set of scripts, but I have an issue writing it in terms of a function and script file. The following line is required but I don't know how ...
0
votes
0answers
17 views

finding the pvalues of a nonnegative least squares solution

I am using matlab and I wanted to ask how I can generate the pvalues of the coefficients in a nonnegative least squares solver. For example, if I use the function 'fitlm', it shows the solutions and ...
1
vote
2answers
26 views

Blockproc to Average an Image

I'm trying to average the values of a MxN block in an image and replace that block with a MxN matrix with the average value. Using blockproc my code looks like: a = imread('image.jpg'); fun = @(x) ...
1
vote
1answer
34 views

MATLAB: Identify maxima and minima and split data accordingly

I have the following arrays: x = [1:33]; y = [0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 1 2 1 0 1 2 3 4 3 2 1 0]; I need to separate y into different sections. I need to obtain the ascending parts, ...
0
votes
0answers
11 views

How can I use a trained model of time series for prediction a new problem? Not for one or some steps ahead but for new time [on hold]

Suppose, I have a daily system and I trained a neural network or other tools over this system as a predictor of a target value in time series data. Now, I want to use this trained model for another ...
0
votes
0answers
27 views

How to use biplot() in Matlab

I am new to Matlab and I do not know the syntax well enough to do this task. I have a data set and I split it into training and testing data as below: X = csvread('mydata.csv'); flag = X(:,1); ...
0
votes
1answer
28 views

Matlab construct of classdef with constraints

I have this classdef what properties ( ... ) ... end methods (Access=public) ... end methods function obj = what(...) ... end % constructor function test = Test1() ... end ...
2
votes
1answer
32 views

What is the name of this Matlab operator?

I came across this code during some troubleshooting in Matlab when trying to find peaks of a signal: minValue = min(yourSignal); yourSignal(yourSignal < threshold) = minValue; What I think it ...
0
votes
2answers
26 views

MATLAB: Problems with plotting dates on x-axis (line graph)

I, again, hope for your help with the following MATLAB problem: I imported a csv-file from Excel into MATLAB, using the import tool. The data consists of dates (format dd.mm.yy HH:mm) for the x-axis ...
0
votes
1answer
32 views

How to set axis limits globally in MATLAB to min and max of data plotted?

I am trying to plot some figures in MATLAb. Once using the subplot feature to have several graphs beside each other the axis limits change, so I do not have them to the min and max of x and y and ...
0
votes
0answers
23 views

Training SVM model by changing soft margin resulting in 100% accuracy or 100% Class 1 or 100% Class 0

I'm trying to train an svm model in Matlab with a numerical matrix. 150 rows where each row represents a vector of length 250. Each row is classified to either '1' or '0'. I separate the data into ...
0
votes
0answers
15 views

QM coder - coded value C always overflows

In all literature concerning QM coding, one can find pseudocode for QM encoder, which always looks like this: When I tried to implement this code, I always face the following problem: The C value ...
1
vote
1answer
37 views

How can I determine the number of trees in random Forest in matlab?

In Matlab, we train the random forest by using TreeBagger() method. One of the parameters of this method is the number of trees. I am using random forest for classification approach. How can I ...
0
votes
1answer
14 views

Best option for creating user interface with embedded matlab functions

I have created a matlab function to do a mathematical calculation. I have made a desktop standalone application using GUIDE, but it takes about a minute to start the application. It is too slow i ...
0
votes
0answers
17 views

MATLAB: Is it possible to generate multiple spheres and save them as objects in one script file?

As I stated, I am working on an assigment at school and I am pretty stuck at one part. It is an assigment where I am suposed to generate several spheres andput them through different movment like ...
0
votes
0answers
8 views

Reading CFA of a DNG image in matlab generates all-zero image

I wrote the matlab code as https://blogs.mathworks.com/steve/2011/03/08/tips-for-reading-a-camera-raw-file-into-matlab/ mentioned to read the Color Filter Array of my DNG file, the code is as below: ...
0
votes
0answers
13 views

error : Invalid Mex-file in MATLAB R2013a

I have tried to use a system object in order to find a transformation matrix corresponding to the matching point pairs using RANSAC algorithm, and an error of "Mex file entry point is missing. Please ...
2
votes
1answer
34 views

Total power of sine in matlab

i'm trying to use pwelch orperiodogram to get the power of a signal at different frequencies. As a test i tried a single sine: sqrt(2)*sin(x) It should has a power of one. However, my script shows ...
0
votes
0answers
21 views

Remove duplication on the plot, matlab?

I have the following data and I would like to plot them on a 3D figure. One of the columns has a duplicate values, is there a way to plot them without the duplication. YParetoFront XParetoFront ...