matlab questions

matlab questions

• All Sites

## Get absolute peak location in a vector in MATLAB

Suppose I have the A matrix like this: A = [0,0,0,0,0,0,106,10,14,20,20,23,27,26,28,28,28,23,28,28,21,18,106,14,12, 17,16,15,22,19,20,18,21,23,23,18,17,15,106,28]; >> plot(A) I want the ...

2 answers | 15 mins ago by user2201486 on stackoverflow.com

## Why can't I get convolution to work properly in MATLAB?

Convolving signals in MATLAB produces unexpected results every time. Take the following code for example, in which I attempt to convolve a rect function with itself: clc clear all x=-5:.01:5; ...

1 answers | 20 mins ago by David Webb on stackoverflow.com

## plot a decision curve for logistic regression with gaussian Kernel

I have tried using logistic regression with polynomial feature, and fortunately its working fine for me and also I am able to plot the decision curve. I have used map_feature function for polynomial ...

## Using ARPACK solving eigenvalueproblem, but getting inconsistent results with Matlab

I'm new to ARPACK, I downloaded a script like the following import time import numpy as np from scipy.linalg import eigh from scipy.sparse.linalg import eigs np.set_printoptions(suppress=True) n=30 ...

## Solving Duffing equation by Matlab ode23

How can I use Matlab to solve numerically this duffing equation with known $\kappa, \Gamma, \omega$..thanks.. $$x'' +\kappa x' +x -x^3 =\Gamma \cos\omega t$$ I have only few knowledge of Matlab..

## Creating a basic feed forward perceptron neural network for multi-class classification

I am new to neural networks and I want to create a feed forward neural network for mutli-class classification. I am allowed to use any code that is publicly available but not any MATLAB ToolBox as i ...

## Calling an .m file through another function file in matlab

My professor is having me write a program to perform the bisection routine to find the root of an equation. Before I go on, here are the program files so far: function [l,r,nf] = ...

1 answers | 2 hours ago by Brandon1234 on stackoverflow.com

## Using different intensities of a specific color for contour plots

This question is in reference to visualization of EM clustering(or K-means) of 2D gaussian data. Say, I have displayed 3 clusters obtained from EM in a scatter plot with 3 different colors(say r,g,b) ...

## Calling R from Matlab, Error: could not find function “loadMethod”

I want to call an R script in Matlab and wrote the following script in MATLAB: CurrentDirectory=strrep(pwd,'\','/'); eval(['!C:\Programs\R\R-3.1.1\bin\i386/Rscript "' CurrentDirectory '/GOF.R"']) % ...

1 answers | 2 hours ago by Banou on stackoverflow.com

## Improving efficiency for Matlab : multiple loops with large data

I have the below process. for x = 1:60 for y = 1:160 % load a 2D 'Image' from a 3d matrix for a = 0:52 for b = 0:52 imageWin = ...

## Issue with imdistline() function in MATLAB?

I am trying to measure the distance two points on an image and then use that distance as an input for some other function. Here is my code: figure, imshow(I); h = imdistline(gca); api = ...

## reading remote images in ssh server with matlab

Is it possible to read an image in a remote server with ssh in a matlab code? I mean, I want to do this, but Matlab is not allowing: ...

## maxima multiple trigonometric equations

I'm trying to solve an equation using maxima 13.04.2 but the answer isn't what I expect. Example: y2=A2*cos(2*pi*f2*t+phase2) we know A2=.4,f2=6.4951,t=1, trying to find **phase2** ...

## Unconstrained nonlinear optimization function

I want to optimize an unconstrained multivariable problem using fminunc function in MATLAB. Here is an example: Minimize the function f(w)=x'Ax Create a file myfun.m: function f = myfun(x) f = ...

1 answers | 5 hours ago by user3138073 on stackoverflow.com

I have a 128 x 1 input in block 'Local maxima'. I want to take as an output, the 4 maximum values of an input. I set: Maximum number of local maxima: 4, and Neighborhood size: [1 1]. I expect to take ...

2 answers | 5 hours ago by billias pap on stackoverflow.com

## Matlab: Assign weights to angle mesh values to get an Isotropic Field

I have a 2D spatial field of dimensions MxN with angle values (0-360 degs) in each node (x_i,y_j). In Matlab I trace the trajectory of a particule starting at (StartX,StartY) through the fild with the ...

## Find points forming lines using Hough transfrom

I have a dataset and I would like to group the points forming lines parallel to the Y axis (see image). I guess the way to do it is by using the Hough transform; do you have any suggestion of how to ...

## Joint Entropy of audio files

So, after trying a heavy cicle-based function for calculating the joint entropy of two sources of information, I found this useful MATLAB function, accumarray, and tried the following code: function ...

## MATLAB identify adjacient regions in 3D image

I have a 3D image, divided into contiguous regions where each voxel has the same value. The value assigned to this region is unique to the region and serves as a label. The example image below ...

## Store an unknown number of vectors into a cell array

How to store all the vectors s into a cell array, so that I can use it later. the number of vectors s is not specific, it depends on the condition "while sigma > sigma_min". Anyone can help me? Thank ...

## Plot dots and squares on two images in matlab

I know this has been asked before, but I couldn't apply it. I'm applying homography on an image, and for the report, i need to show which points I did chose (plotting dots), and I need to show also ...

## Find a sinusoidal fit from data with fft

I have a vector with raw data (120 samples). From the frequency spectrum I can tell there is one dominant frequency component. Now I am supposed to use the fft data (magnitude and phase) to find a ...

1 answers | 6 hours ago by user2750354 on dsp.stackexchange.com

## How to achieve this requirement in MATLAB

How to store all the vectors s into a cell array, so that I can use it later. the number of vectors s is not specific, it depends on the condition "while sigma > sigma_min". Anyone can help me? Thank ...

## Count the number of rows between each instance of a value in a matrix

Assume the following matrix: myMatrix = [ 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 ]; Given ...

2 answers | 7 hours ago by Alarik on stackoverflow.com

## Plot discrete points and some circles that enclose them in matlab

I'm trying to plot some eigenvalues along with their Gershgorin circles in matlab, but don't seem to be able to find the syntax to get the discrete points (the eigenvalues) to show up. This is what ...

2 answers | 7 hours ago by Peeter Joot on stackoverflow.com

## Disable Zero-Crossing Detection for specific subsystem only

Trying to disable the Zero-Crossing detection for only a given subsystem ( User-defined Matlab Function Block) in my simulink Model, I referred to the Matlab Central Guide, however, for User-defined ...

1 answers | 7 hours ago by user2536125 on stackoverflow.com

## Controlling Matlab instance through C# application

Background I have several Matlab scripts that create interactive sessions with the user (kind of like a game), and I want to create a C# GUI as a front-end to kickoff these scripts instead of ...

1 answers | 7 hours ago by Setsu on stackoverflow.com

## Detecting shape in matlab using corr().

I am trying to write a function where I have two images, and I have to detect one image in another image. But I want to do it without using normxcorr(). Instead, I was thinking about implementing ...

## Why LOG filter is returning the black background image?

I had taken co-relation of image with LOG filter via imfilter command. z=imfilter(I,fspecial('log',11,1.5)); figure imshow(z); Image:

3 answers | 7 hours ago by M.Zaman on stackoverflow.com