Answered
Program code for convolution
u = [1 2 3 1]; v = [2 3]; conv(u, v) % filter(u, 1, v)

3 years ago | 0

Answered
plotting a surface on a cylinder top face
theta =0:0.01*pi:2*pi; r=0.8; x=r*cos(theta); y=r*sin(theta); z=zeros(size(x)); % simple patch for base p_base =patch(x,...

3 years ago | 0

Answered
How to remove cell data from specific column using dates as a reference?
T = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1085695/flowrate_dates.xlsx", "Sheet", 3) idx = T...

3 years ago | 0

Answered
combine two cell into one string
t = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1085370/SummaryResult%20-%20Copy.xlsx'); t = t(1:...

3 years ago | 0

| accepted

Answered
Echo+noise signal
% generate a waveform f0 =100; fs=1000; pw = 0.1; pri = 1; npulses = 10; s = cos(2*pi*f0*(0:1/fs:pw))'; % it can be ...

3 years ago | 1

| accepted

Answered
Spectogram Of I and Q data
x = xi + 1i*xq; spectrogram(x)

3 years ago | 0

Answered
Transfer Quarterly dates to Monthly
% Your data dtstr = ["31/3/1992" "30/6/1992" "30/9/1992" "31/12/1992"]; x = [1.2 1.3 1.4 1.5]...

3 years ago | 0

| accepted

Answered
What is the training accuracy of this model?
If Labels is character array instead of string array, then numel(Labels) will give the number of characters instead of the numbe...

3 years ago | 0

| accepted

Answered
Get coordinates points inside a 3-D circle in MATLAB
normal=[-3.5556 -0.2222 1.0000]; center=[138 146 219]; radius=3; plotCircle3D(center,normal,radius); hold on point = p...

3 years ago | 0

Answered
How can I label multiple routes on a geoscatter plot?
fig = figure; %pos = fig.Position; %files = dir('cast*.gpx'); for i = 1:5 %length(files) %filename = files(i).name; ...

3 years ago | 0

| accepted

Answered
operation on single elements in MATLAB
x=-2:1:2; %coordinates x y=x.^2; %coordinates y z=[x;y] d = diff(z, 1, 2) % diff along 2nd dim d = vecnorm(d...

3 years ago | 1

Answered
specifying frequencies in pwelch not working
No problem for on-line matlab. data = randn(20000,1); %assume this is 1 row of my EEG data of interest analysisWinSize = 1000...

3 years ago | 0

Answered
Create duration array template
ti = duration('00:00:0.00','Format','hh:mm:ss.SSS'); tf = duration('02:00:0.00','Format','hh:mm:ss.SSS'); interval = millise...

3 years ago | 0

| accepted

Answered
Multiply values in array by *-1
a = randn(1, 106); a(14:20) a(16:18)=-a(16:18); a(14:20)

3 years ago | 0

| accepted

Answered
How to find sum of previous 5 numbers in a column..
x = [56 45 56 678 678 568 2 3 4 5]; y = filter(ones(5,1), 1, x) y1 = y(5:end)

3 years ago | 0

| accepted

Answered
Graph function problem Incorrect values
What's wrong? x=[0:50]; y=-x.^3+3*x.^2+2*x-27; plot(x,y)

3 years ago | 0

| accepted

Answered
How to reduce running time of diagonal matrix multiplication with full matrix in Matlab?
n = 2000; d=500; B = randn(d, n); dv = randn(n, 1); D = diag(dv); % Normal tic A = B*D*B'; toc % Speed up 1 tic C = ...

3 years ago | 0

| accepted

Answered
How to make a number NaN when its both neighbours are NaN?
A = [NaN 2.35 NaN 2.358 1.68 1.98 2.88 NaN 2.68 NaN 2.70 NaN 2.20 NaN 3.03; NaN NaN 2.77 NaN 2.67 1.87 2.56 1.88 2.39 NaN...

3 years ago | 0

| accepted

Answered
adding an if condition so the negative value would be set to zero
for i=1:length(t) DOD(i)=cumsum((T(i)*30)/(3600*14.6)); end DOD = max(DOD, 0)

3 years ago | 0

Answered
Circular bar graph in matlab
% Some data T.Country = string(('A':'Z')'); T.Population = randi([1000 10000], size(T.Country)); T = struct2table(T); n = he...

3 years ago | 1

Answered
Plot with break in curve
xy=[0.0000 -963.0477 0.0043 -961.9818 0.0085 -960.8602 0.0128 -959.6834 0.0171 -958.4515 0.0214 -957.16...

3 years ago | 0

Answered
removing the pixels with different size and unregular shape
A simple approach is to find the regions you want to deleted (assign 0). Four your question, rectangle regions are sufficient: ...

3 years ago | 1

Answered
How to plot like this graph?
% [1 2][3 4] % [6 7] h(1) = subplot(2, 4, [1 2]); % 4x2 grid, 1st subplot plot(randn(10, 1)); h(2) = subplot(2, 4, ...

3 years ago | 0

| accepted

Answered
Error using mesh Z must be a matrix, not a scalar or vector. Error in untitled6 (line 5) mesh(W,Y,Z)
w = 200:50:450; y=120:30:240; [W,Y] = meshgrid(w,y); Z= 64.0189+1.4629*W-2.626*Y-0.0012*W.^2+0.0098*W.*Y+0.0082*Y.^2; whos ...

3 years ago | 0

Answered
How to read .XY file?
file='random_x.txt'; fid = fopen(file, 'rt'); i=1; s1 = ''; while ~feof(fid) s{i} = [s1 fgetl(fid)]; %...

3 years ago | 0

| accepted

Answered
regexp function - get index of string with two conditions
str = {'strawberry/banana#(';'apple#,melon*cherry';'apple_banana_cherry'}; s = regexp(str, '^apple.*(cherry)$', 'match'); id...

3 years ago | 0

| accepted

Answered
creating a rectangle plot
p = [0 2 2 3 3 5 5 0 0; 0 0 1 1 0 0 4 4 0]; plot(p(1,:), p(2,:))

3 years ago | 0

Answered
copying the contents of a vector onto a longer vector
a = [1 2 3 4]; b = a(mod(0:9, 4)+1)

3 years ago | 0

| accepted

Answered
How to design a FIR filter by the -3db bandwidth?
Generally speaking, you don't have to worry about -3dB attenuation at the cut-off. You just specify the pass-band and stop band...

3 years ago | 0

| accepted

Answered
To generate a series with n numbers on and n numbers off
n = 8; xmax=100; x = (0:n-1)'+(n:n*2:xmax); x=x(:)

3 years ago | 0

Load more