Answered
3d point cloud into voxel grid
load data voxelsize=0.5; for i=1:3 tmp=xyz(:,i); edges=min(tmp):voxelsize:max(tmp)+voxelsize; xyz(:,i)=di...

5 years ago | 1

| accepted

Answered
ifft2 on GPU array
I think it's a bug, but one solution might be, fn=@(z,d) ifft(z,[],d,'symmetric'); out = fn( fn(gAs .* gBs,1) ,2);

5 years ago | 1

Answered
how to plot a function on a 3D sphere?
My recommendation would be to build these surfaces using the cylinder function, e.g., R=1; %radius of circular cross-section...

5 years ago | 0

Answered
How to write program for this block matrix
A=zeros(4); B=[ 0 0 1 0; 0 0 0 1; 1 0 0 0; 0 1 0 0 ]; final=[A,B;B',A]

5 years ago | 0

| accepted

Answered
Inconsistent assignment time for matrix inside a class
When the program is slow, the cost of "o.x(1,1)=1;" seems linear to the size of o.x. Naturally. Every time you append to x, th...

5 years ago | 1

Answered
Adding more data points using interpolation
interp1(SZA, linspace(1 , numel(SZA), numel(ElectricField)) )

5 years ago | 1

| accepted

Answered
how to get the answer in matrix for only one matrix variable. For instance if x = [1 2 3 4 5], y =3, z= x+y. how do i get z= [4 5 6 7 8]
V2 = 10; h1 = 9; P1 = 5; p = 1000; g = 9.81; h2=2; V1 = [1 2 3 4 5] P2 = P1+p./2.*(V1.^2-V2.^2)+p*g*(h1-h2) plot(V1,...

5 years ago | 0

| accepted

Answered
Hi, i want to get a gaussian curve fitting plot, function is y = A*exp-((x-mu)^2/2*sig^2). y axis must be between -0.2 and 1 with counting by 0.2 per each step, any tips?
f = @(x,A,mu,sig) A*exp(-(x-mu).^2)./(2.*sig^2); A = 1; mu = 7; sig = 1.5; x = (0:2:10); y = f(x,A,mu,sig); plot(x,y); ...

5 years ago | 0

Answered
Solution of Linear Programming Problems with Matlab
In addition to not entering the positivity constraints x(i)>=0 and mis-typing f, you entered <= constraints instead of >= constr...

5 years ago | 0

| accepted

Answered
Roots of Polynomial in for Loop
I don't understand your description of the objective function. The roots of a multivariable function are not scalars, and theref...

5 years ago | 1

| accepted

Answered
How to iterate diagonal with alternating values?
One way, d=ones(1,n); d(1)=0; d([2:4:end, 3:4:end])=e_p; HM=diag(d);

5 years ago | 0

Answered
How to convert 183*5 matrix data into column vector data
You mean like this? x=rand(183,5); y=x(:); whos x y

5 years ago | 0

Answered
Newton-Raphson fractal script problem
I would recommend doing the Newton's method iterations as below. f = @(z) z.^3-1; df = @(z) 3*z.^2; e = 0.00001; x=-3:0.001:...

5 years ago | 0

Answered
how to use fsolve with multiple variables with unique names, not vectors
This would make my optimization function a bit more difficult to read. There is no rule that you have to refer to your variable...

5 years ago | 1

Answered
how to use fsolve with multiple variables with unique names, not vectors
fun = @(x) opt(x(1), x(2), x(3), alpha_KW, T_D, y1_D, Re_es, nu_gD, rho_gD); x1_F0 = 0.5; T_WA0 = 345;T_F0 = 355; xopt = f...

5 years ago | 1

Answered
how to find the smallest object in the coin image?
This should make it easier: A = imread('eight.tif'); C=imbinarize(A, 'adaptive', 'ForegroundPolarity', 'dark'); C=bwareafilt(...

5 years ago | 0

| accepted

Answered
Create a bar graph where the next bar starts where the previous ends
For example, y = [4 2 3; 1 6 5]'; n=size(y,1); dy=([1,-1].*y).'; yc=[0, repelem(cumsum(dy(:).'),2)]; ymin=min(yc(...

5 years ago | 0

| accepted

Answered
How to overload a single parentheses indexing operation, not all of them?
Here is a way to do it by overloading subsref. You might have to do the analogous implementation of subsasgn, if assignments are...

5 years ago | 0

Answered
undocumented expectations and behavior of fimplicit
According to my experience, code following the call to fimplicit executes in parallel (and non-deterministically) with the evalu...

5 years ago | 0

Answered
input vector as point to numeric function
It's not clear from your description where the random generation of p is supposed to happen. If it happens prior to calling f(),...

5 years ago | 0

Answered
How to extract values from specific coordinates
You can use interp2() or griddedInterpolant().

5 years ago | 0

| accepted

Answered
Performance of log() is wildly different in two different contexts and machines for same data?
I'm noticing that mask arrays with lots of 0s or negative numbers tend to be giving the 16 GB machine trouble. Because your mo...

5 years ago | 0

| accepted

Answered
Concatenation of large arrays in a cell is inefficient
The inefficient part is the creation of the full matrix [zeros(c_1*(i-1),c_2);... array_1 .* array_2;... zeros(c_1*(h...

5 years ago | 0

| accepted

Answered
surf indices reversed?
Yes, the x-axis traverses the rows of z and the y-axis traverses the columns. For some reason, many people prefer their x-axis ...

5 years ago | 0

| accepted

Answered
Check if the condition happened in previous cycles
Update a boolean flag to keep track of it. flag=true; %initial state for n=1:N flag=flag & PE(n-1,1)>p_fix; ...

5 years ago | 1

| accepted

Answered
Find Shortest Path in Coordinate based Multiple Circle Using Rand
The fact that your X,Y data came from a random number generator seems irrelevant. Once they have been generated, they define a g...

5 years ago | 0

Answered
How to perform arithmetic operation that would affect all variables in a folder at once
For scalar variables, S=dir('crate*.mat'); month = arrayfun(@(s) load(s.name).month, S)/0.5; time = arrayfun(@(s) load(s.na...

5 years ago | 1

| accepted

Answered
How can I find a doble sum series?
[a,b,c,d,k]=deal(4,5,1,2,0.5); %fake constants I=(0:b)'; J=(0:a); bicoeff=@(alpha,n) prod(alpha-(0:n-1))/factorial(n); ...

5 years ago | 0

Answered
Figure 3D rotation does not work in App Designer
The documentation for view3d says that you can specify a figure handle % VIEW3D(FIG,...) works on the figure FIG

5 years ago | 0

Answered
Convert 2D spatial coordinates and related values to a matrix
x_spatial_coordinates = [0.5 0.5 0.5 0.5 0.5 1.5 1.5 1.5 1.5 1.5 2.5 2.5 2.5 2.5 2.5]; y_spatial_coordinates =[0.5 1.5 2.5 3.5 ...

5 years ago | 0

| accepted

Load more