Answered
extending a set of rows from matrix using calculated vector of start and end indexes
testMatrix = magic(100); indexStartt_matrix =repmat(1+4*(0:5-1), 3, 1); startindex = indexStartt_matrix(:); startAndEndIndex=...

5 years ago | 0

Answered
How can I merge multiple columns between two matrices?
d = a d(:,c==1) = b(:,c==1)

5 years ago | 0

Answered
Interpolating at centroid of a tetrahedral mesh
The vector at the centroid of the tetrahedron is just the mean of the 4 vectors taken at 4 vertices. So using MEAN with appropr...

5 years ago | 0

Answered
Linear segmentation of noisy data
Similar topic discussed here Using my solution of BSFK % Generate random data N = 5; % number of linear segments + 1 breaks...

5 years ago | 0

Answered
How to use voxels of different sizes to measure the volume of a 3D object using Matlab?
Vol estimate = 1.2692e+06 xyz = load('Cone_20000_points.txt'); [minxyz,maxxyz] = bounds(xyz,1); N = 30*ones(1,3); % resolut...

5 years ago | 1

| accepted

Answered
y-axis' unit of measure of a FFT and of a PSD
For a vector A of length N B = fft(A) The Parseva'sl theorem tells norm(A) = norm(B) / sqrt(N) So actually the unit of B / ...

5 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Error in EigenHubb (line 54) Z(:,:,1:m) = C; % In the {n =1} sector, there are m =6 possible states.
Just remove this Z = []; The rest I don't know. if it's correct since you seem to have problem with matrix size and loop. Your...

5 years ago | 0

Answered
sprintf is it safe to use?
It's not safe for C where strings are 0 terminated. But for MATLAB the length is inside an internal (mxArray) structure, so it'...

5 years ago | 1

| accepted

Answered
Vectorization of an Expression
Apparently no https://www.mathworks.com/matlabcentral/answers/585323-vectorization-time-varying-recursive-linear-function

5 years ago | 0

| accepted

Answered
Plot a surface with cross-section matrix
theta = your_angle r = your_radial z = your_z % wrap around to close the azimuthal patch theta = theta(:,[1:end 1]); r = ...

5 years ago | 0

| accepted

Answered
Store values generate in a function call in an array
spheresXYZ = cell(1,SizeXYZ); for i = 1:SizeXYZ [x,y,z spheresXYZ{i}] = createspheres(x1(i),y1(i),z1(i)); ... end

5 years ago | 0

| accepted

Answered
Calculating hamming distance and return the array correspondingly to minimum value between the given possibilities
arr=[1 0 0 1] tuple = [ 1 0 0 0 ; 1 1 1 1 ; 0 0 0 0 ] % cell2mat({ 1 0 0 0 ; 1 1 1 1 ; 0 0 0 0}) n = sum(xor(tuple,arr),2); ...

5 years ago | 0

| accepted

Answered
How to apply function "strrep" to multiple substrings
newIDFFile = ... strrep( ... strrep(... strrep( ... strrep(readIDFFile, ... '@@P1@@', num2str(u_gen_s))...

5 years ago | 1

| accepted

Answered
linear optimization problem in matlab
Add this to display the solution X F

5 years ago | 0

| accepted

Answered
Vectorising a Meshgrid Coordinate Construction
One way [~,nx] = size(X_co); [~,ny] = size(Y_co); [m,nz] = size(Z_co); [NX,NY,NZ] = meshgrid(1:nx,1:ny,1:nz); sz = [size(NX...

5 years ago | 1

| accepted

Answered
sscanf with cell array of strings
>> C = {'2_5_7';'10_2_6';'4_3_7';'3_10_11';'3_16_11_12_20'} C = 5×1 cell array {'2_5_7' } {'10_2_6' ...

5 years ago | 0

Answered
string cell array inside a graph
I'm surprise no one give you get an answer. There is some subttle internal working needed to be explained. The syntax C{[2 3]...

5 years ago | 0

| accepted

Answered
Problems with while loop
"Hi, I have a problem, I want the subtraction d1 to be less than 1 * 10 ^ -15 after several iterations, but the program stays bu...

5 years ago | 0

| accepted

Answered
How to split a polygon.
Each slice has area of 9.5 x=[0 4 7 5 1]; %Polygon x-coordinates y=[0 -2 0 10 8]; %Polygon y-coordinates n = 6; P = pol...

5 years ago | 1

| accepted

Answered
rref gives an impossible answer
I multiply all your array by 10000, so every inputs are integers P = [9871 0027; 0129 9973]; A = P - 10000*eye(2); B = [A [0;...

5 years ago | 1

| accepted

Answered
Generating a random number inside a function decleration
The right tool is not odexxx but this one is you have the toolbox.

5 years ago | 0

Answered
How to divide the object cone into layers (e.g. slices) of certain thickness(e.g. thickness = 10 or 5 ...) to measure it volume layers-wise.?
Among the methods that you request , this one is the worst method. R = 78; h = 188.4000; Vtheoretical = pi*R^2*h/3 % 1200324....

5 years ago | 0

| accepted

Answered
qr decomposition run-time performance
I'm pretty sure both Q-less-qr and qr use the same algorithm. What you should try is Option 3 [~, R] = qr(A,0); that will re...

5 years ago | 2

Answered
delete locally outliers with window size
load('indx.mat'); % Change windows size and threshold eventually midx = medfilt1(indx,3); % This requires signa...

5 years ago | 0

Answered
Increase the dispersion range of the points plotted within the sphere
This code generates randomly n 3D points unifformly distributed inside the hemi sphere r < radius and z > 0. radius = 76; n = ...

5 years ago | 0

| accepted

Answered
separate matrix into cells according to column value
One liner (not the fatest) B = splitapply(@(x) {x}, A(:,1:2), A(:,3))

5 years ago | 0

| accepted

Answered
Loosely Constrained Least Squares Solution
alpha = some positive value; % larget alpha, norm(C*x-d) gets smaller E = [A; alpha*C]; f = [b; alpha*d]; x = lsqlin(E,f,...

5 years ago | 0

Answered
Shade the encircled area
Use polyshape and let polyshape do the work. Replace plot(P1, ...) with normal plot if you don't like the artefact on x-axis. t...

5 years ago | 1

Answered
How to use isosurface to measure volume of the cone??
Theoretical volume = 2094.4, Isosurface estimation = 2092.4. Pretty good to me. R = 10; h = 20; N = 1e5; % Theoretical vo...

5 years ago | 1

| accepted

Load more