Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
Eig function and chol function returning wrong matrix factorization
You make two mistakes, please see comments (where "Bruno" appears) in this corrected code %------------------------------------...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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

plus de 2 ans il y a | 0

Réponse apportée
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 ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Convert 1x1 cell array to double
Not sure if it's more efficient but it's shorter rttTime = str2num(rttTable.vectime{1})

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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'...

plus de 2 ans il y a | 1

Réponse apportée
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')) ...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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 ./ ...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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) ...

plus de 2 ans il y a | 0

Réponse apportée
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); ...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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." ...

plus de 2 ans il y a | 0

Réponse apportée
How to vectorize?
Just to pull out the right answer (my previous answer applied on a WRONG calculation specified by OP) % vectorized method c = ...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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); ...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Question


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...

plus de 2 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Question


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...

plus de 2 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
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',[])

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How to get the current rotation angle of an object when using interactive vol=volshow(img3D)?
axehandle = gca [az,el] = view(axehandle)

plus de 2 ans il y a | 0

Charger plus