已回答
Reshaping of 3-dimensional array to construct an isosurface
I just fix the code without knowing what is really your aim. I'm surprise you do all kind of kron and eigs and get lost in the u...

3 years 前 | 0

已回答
Eig function and chol function returning wrong matrix factorization
You make two mistakes, please see comments (where "Bruno" appears) in this corrected code %------------------------------------...

3 years 前 | 0

已回答
How to get subplots made of a group of already existing .fig
It seems to work for me % I invent this part for fig = 1:8 hf(fig) = figure(fig); plot(sin(linspace(1,fig))); s...

3 years 前 | 0

已回答
How MATLAB fft processes data which length is not equal to 2^p (p = 1,2,...)
MATLAB FFT use FFT in the est library. The reference here explain the algorithm http://www.fftw.org/fftw-paper-ieee.pdf

3 years 前 | 0

已回答
Extract numbers from a list
succeed = false; while ~succeed c = repelem(4,37,1); n = sum(c); r = rand(1,n); y = []; for i=1:n ...

3 years 前 | 0

| 已接受

已回答
Convert 1x1 cell array to double
Not sure if it's more efficient but it's shorter rttTime = str2num(rttTable.vectime{1})

3 years 前 | 0

已回答
How to use the quadprog function for solving non-convex quadratic optimization problems in Simulink?
I'm not sure about simulink, but for MATLAB , you have only limited support for non-convex by quadprog: "The 'interior-point-co...

3 years 前 | 0

已回答
Find the velocity of a travelling wave like behaviour
%s =load('solution.mat'); %SS = s.sol; % Create fake N and SS N = -20:0.1:20; v = arrayfun(@(x) x/(sqrt(1+x^2)), (1:40)/10...

3 years 前 | 0

| 已接受

已回答
Which triangulation Method is used for natural scattered interpolation?
Voronoi tessellation and Delaunay triangulation are two faces of the same coin. They can be derived one from another. https://ca...

3 years 前 | 0

| 已接受

已回答
How to get rid of this nested for cycles?
If you want to work with cell % simulating similar inputs: K = 3; H = 250; N = 50; B = 10; Q = cell(1,K); rng('default'...

3 years 前 | 1

已回答
Edge Detection in a 2D Matrix
Do you want this load(websave('data.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1446792/data.mat')) ...

3 years 前 | 1

已回答
How to get rid of this nested for cycles?
There is no reason using cell, rather 4-dimensional array. Admitely the code is not clear if you don't keep track which dimensi...

3 years 前 | 1

| 已接受

已回答
smooth noisy data with spline smoothing
See those threads can help you https://www.mathworks.com/matlabcentral/answers/1772125-how-to-generate-a-smooth-derivative-afte...

3 years 前 | 1

| 已接受

已回答
Indexing nearest value to my coordinate
It is odd that you want to find the index of nc file data closest to the Station. It just sounds more natural to look for the o...

3 years 前 | 0

已回答
The multiplication result by sum() and matrix multiplication are not the same
You cannot prevent the roundoff error to occur and operation order dependency. Even for the same computer the result can chang...

3 years 前 | 0

已回答
Circular vortex with spin vectors
[x,y] = ndgrid(linspace(-1,1,10)); x = x(:)'; y = y(:)'; xy = [x; y]; r = vecnorm(xy, 2, 1); r(r > 1) = NaN; xyn = xy ./ ...

3 years 前 | 1

已回答
how velocize it? (it's possibile to vectorize it?)
I don't know the memory requirement would go up if I vectorize the outer loop in a non-toy case. So I leave it for now. Ntrades...

3 years 前 | 1

| 已接受

已回答
Draw and color the intersection between two 3D surfaces?
It's sphere extruded by a cone x = linspace(-1.1,1.1,129); y = linspace(-1.1,1.1,129); z = linspace(0,1.1,129); [X,Y,Z] = me...

3 years 前 | 0

已回答
Network adjacency matrix for connecting n node with probability p
Pretty similar to Torsen's solution. Adjust the density and no-loop p=0.1; n=30; A = GenerateAMat2(p, n); nnz(A)/numel(A) ...

3 years 前 | 0

已回答
Network adjacency matrix for connecting n node with probability p
Method without loop, generate entire matrix, symmetrize then remove self-connexion p=0.4; n=10; A = GenerateAMat(p, n); ...

3 years 前 | 0

已回答
How to find the index of an element ?
Compare with tolerance epss = 0:0.00001:0.1; tol = eps(0.1); i = find(abs(epss - 0.00208) < tol) % and if you are lazy to es...

3 years 前 | 0

已回答
Flipping the elements of a vector
"For larger vectors [1:1e6] the second one gives "Out of memory. The likely cause is an infinite recursion within the program." ...

3 years 前 | 0

已回答
How to vectorize?
Just to pull out the right answer (my previous answer applied on a WRONG calculation specified by OP) % vectorized method c = ...

3 years 前 | 1

| 已接受

已回答
How to vectorize?
If you want obscure code by avoiding for-loop E = rand(10,5) Tr = randi(size(E,1),9,size(E,2)) [r,c]=size(Tr); x=(1:3:r); ...

3 years 前 | 1

已回答
abs cannot be used in problem-based optimization expression
Nevermind abs is not supported function https://www.mathworks.com/help/optim/ug/supported-operations-on-optimization-variables-e...

3 years 前 | 0

| 已接受

提问


abs cannot be used in problem-based optimization expression
Can someone tell me why I cannot use abs() in this simple setup. prob = optimproblem(); x = optimvar('x',1,1); y = 1; x0 = s...

3 years 前 | 1 个回答 | 0

1

个回答

已回答
How to put matrices defined earlier in "for loop" later
I have no idea if you expect this syms x p_1 p_2 r rho_alpha = (1/21).*[2 0 0 0 2 0 0 0 2;0 5-x 0 0 0 0 0 0 0;0 0 x 0 0 0 0 0...

3 years 前 | 1

| 已接受

提问


using feval or not?
I have function handle myfun I need to evalute I prefer using feval https://www.mathworks.com/help/matlab/ref/feval.html y = f...

3 years 前 | 1 个回答 | 0

1

个回答

已回答
Is it possible to programmatically suppress figure roll-over menu (zoom, rotate, etc)?
ax = gca; % your axe handle if you can get it other than gca set(ax,'Interactions',[])

3 years 前 | 0

| 已接受

已回答
How to get the current rotation angle of an object when using interactive vol=volshow(img3D)?
axehandle = gca [az,el] = view(axehandle)

3 years 前 | 0

加载更多