Solved

How close to a hole
Suppose you have a description of good places (ones) and bad places (zeros). You want to know your distance from a bad place (in...

Solved

Find the same and successive values in a vector
Find the same and successive values in a vector. For example: Input x = [ 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 ] Start and end...

How to do a band pass filtering in matlab?

Question

How to plot stacked variables with common x-axis?
Hello everyone, I am trying to produce a figure similar to the one attached. As you can see, for each Y, there is a function of...

### 2

Is expm accurate to compute transition probabilities for a continuous-time Markov chain?
expm(sig) computes the matrix exponential of sig according to: [V,D] = eig(sig) expm(sig) = V*diag(exp(diag(D)))/V For your e...

code runs properly but the variables in workspace are not shown, How to resolve this issue?
find_PD_MF is a Matlab function. You declared your function without outputs. Therefore, Matlab will not return any output of you...

| accepted

How to find elements of a vector falling between minimum and maximum of an other vector without loop.
c = zeros(size(b)); c(b>min(a(:)) & b<max(a(:))) = 1;

applying delay to real-time process
You can use a timer object. See details here and here.

How to read time of (YY:DOY:SSSSS) format ?
Try this: readtable(filename, 'Format', '%{uu:DDD:SSSS}D %f')

| accepted

Add percentage symbol (%) on contour lines (2019a)
Use '%%' to write the '%' symbol: fprintf('%%\n');

| accepted

How to interpolate geometry along Z axis?
You can use Matlab scatteredInterpolant or griddata.

How to apply if else statement by reading values from a Table file on each value and save output?
% generate values randomly between 0 and 500 for an example a = 0; b = 500; Turbidity = (b-a).*rand(1000,1) + a; TurbidityNE...

| accepted

Plotting a equally distributed quantized signal
% sinusoids in the signal f1 = 369; f2 = 919; f3 = 183; % max and min spectral components fmax = max([f1, f2, f3]); fmin...

| accepted

Finding the nearest neighboors of a point on a 2D plot
First of all, you have to define your distance. The Euclidean distance, for example? Step1: Create nearest neighbor searcher ob...

| accepted

How to make a loop to average the values?
If you want to use a for loop, you can do this for j=14:22 eval(sprintf('BV_%g_L_mean = mean(BV_%g_L,2);', j, j)); ev...

| accepted

3 matrix product without dimension error
You can multiply the matrices directly without a loop. % random matrices x = randn(2, 72); y = randn(72, 72); % multiplicati...

I want to plot a graph for a function which varies according to the range of the variable (Like a piecewise function)
That is because your first condition is the most general (or inclusive). The second condition is satisfied when the tested value...

| accepted

Solved

Hard limit function
Classify x data as if x>=0 then y=1 if x<0 then y=0 Example x = [ -2 -1 0 1 2] y = [ 0 0 1 1 1]

If all points are equal then
% generate 3 matrices for a demo A1 = randn(72,2); A2 = randn(5,2); A3 = randn(3, 2); % generate a structure s = {A1, A2,...

Generates a sawtooth wave with amplitude of 1 unit, a frequency of 2 Hz or (4pi radians per second) and a phase shift of pi/4 radian.
% amplitude amp = 1; % fundamental frequency f = 2; % time span of 10 periods T = 10/f; % phase shift theta = pi/4; % sa...

| accepted

Selection by circular indexing
function y = circularSelect(v, a, b) N = length(v); idx = a:b+N*(b<a); idx(idx>N) = idx(idx>N)-N; y = v(idx); end

| accepted

how to plot group delay with respect to omega_1 and omega_2 for 2-D dimensional digital filter
Use grpdelay. A built-in Matlab function.

how to interpolate for increasing - decreasing type of data set
The function interp2 performs interpolation for 2D gridded data. It has the form Vq = interp2(X,Y,V,Xq,Yq), where X and Y contai...

What is the result of the following command? x = 5 : -2 : 1
Your command has the form: x = x1:stp:x2, where x1 is the starting value, x2 is the end value, and stp is the step. Applying tha...

how to detect circles in the provided .bmp image?
Read Detect and Measure Circular Objects in an Image

reading specific lines from a .txt file
Use readmatrix and specify the 'Range' option. Assuming that you have a one-column txt file, you can use the following: A = rea...

| accepted

In table, how to count a number of specific values by year?
year = [repmat(2018, [3,1]); repmat(2019, [13,1]); repmat(2020, [4,1])]; win = [1;2;0;0;1;0;2;0;2;1;0;2;1;1;1;2;2;1;2;0]; T = ...

Is there any clear explain and simple how to decide what is the best frequency resolution and how to chose the window size for this signal
The question is unclear. If you are asking about the number of points in your signal (i.e., number of samples), then it is sim...

Question

How can I set the labels of multiple axes without iteration?
Hello all, I have a figure with multiple uipanels, each with its own axes. How can I set the labels of all the pannels' axes at...