Answered

How to plot below function of two variables

x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior. y = 0 : 0.02 : 2; [xx,yy] = meshgrid(x,y); f =...

How to plot below function of two variables

x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior. y = 0 : 0.02 : 2; [xx,yy] = meshgrid(x,y); f =...

2 dagen ago | 0

Answered

Relate a value obtained with values that formed it (Vector Relationship)

Assuming those are all numeric vectors of the same length, then [min_SLL,min_idx] = min(SLL); min_dx1 = dx1(min_idx); min_dy1...

Relate a value obtained with values that formed it (Vector Relationship)

Assuming those are all numeric vectors of the same length, then [min_SLL,min_idx] = min(SLL); min_dx1 = dx1(min_idx); min_dy1...

3 dagen ago | 1

| accepted

Answered

How to reshape nested cell arrays in a table

Here is one way: t.Var2 = {reshape(t.Var2{:},4,12)} and analogously for Var3 and Var4. Parsing what that is doing, from the i...

How to reshape nested cell arrays in a table

Here is one way: t.Var2 = {reshape(t.Var2{:},4,12)} and analogously for Var3 and Var4. Parsing what that is doing, from the i...

3 dagen ago | 1

Answered

How to retrieve data from a website?

According to its documentation page, use of urlread is not recommended. It suggests using webread instead.

How to retrieve data from a website?

According to its documentation page, use of urlread is not recommended. It suggests using webread instead.

3 dagen ago | 0

Answered

How to crate only 5 plots out of the 20000 iterations?

Use if mod(k,5000)==0 ... end and just figure or figure(k/5000) Just using the figure command (without any argument)...

How to crate only 5 plots out of the 20000 iterations?

Use if mod(k,5000)==0 ... end and just figure or figure(k/5000) Just using the figure command (without any argument)...

4 dagen ago | 0

| accepted

Answered

lagrangian polynomial function giving the incorrect answer

I don't have a solution for you, but I can say that the line xprod=xprod*((c-Xlist(j))/(Xlist(i)-Xlist(j))); is never reached ...

lagrangian polynomial function giving the incorrect answer

I don't have a solution for you, but I can say that the line xprod=xprod*((c-Xlist(j))/(Xlist(i)-Xlist(j))); is never reached ...

4 dagen ago | 1

Answered

Arrange be in order of their pairing, and count how many times they appear

[C,~,idx] = unique(B,'row'); D = accumarray(idx,A); 1 + 3 + 6 = 10. ;-)

Arrange be in order of their pairing, and count how many times they appear

[C,~,idx] = unique(B,'row'); D = accumarray(idx,A); 1 + 3 + 6 = 10. ;-)

5 dagen ago | 0

Answered

Find a series of consecutive numbers and change index of them

Data(:,1) = cumsum(diff([Data(1,2); Data(:,2)]) ~= 1); will change the first column to what you want. That's might be a bit "o...

Find a series of consecutive numbers and change index of them

Data(:,1) = cumsum(diff([Data(1,2); Data(:,2)]) ~= 1); will change the first column to what you want. That's might be a bit "o...

5 dagen ago | 2

| accepted

Answered

while loop mixing number with word

Use a cell array instead: i = 1; a = 5; while (i<10) student{i} = a a=a+5; i = i+1 end See this Answers tuto...

while loop mixing number with word

Use a cell array instead: i = 1; a = 5; while (i<10) student{i} = a a=a+5; i = i+1 end See this Answers tuto...

5 dagen ago | 0

Answered

Loop not working properly

What you are observing seems correct to me. theta is 0, and phi is constant. This means that even as r increases y is zero (be...

Loop not working properly

What you are observing seems correct to me. theta is 0, and phi is constant. This means that even as r increases y is zero (be...

6 dagen ago | 0

| accepted

Answered

My licensed Mathworks products (Home Use License )

Quoting from my R2019a Home license agreement: A Named User may install the Programs on up to four (4) different Computers but ...

My licensed Mathworks products (Home Use License )

Quoting from my R2019a Home license agreement: A Named User may install the Programs on up to four (4) different Computers but ...

7 dagen ago | 0

Answered

How to save Figures using "print" with a filename from a variable?

It's a straightforward extension of what you are doing now. For example k = 1; y = 1989; sprintf('/Users/Figure3/figCI_%d_%d....

How to save Figures using "print" with a filename from a variable?

It's a straightforward extension of what you are doing now. For example k = 1; y = 1989; sprintf('/Users/Figure3/figCI_%d_%d....

7 dagen ago | 0

| accepted

Answered

Interpolation using scattered query points

I believe the solution you point to can be trivially vectorized: load clown ; imagesc(X); colormap gray ; [nx,ny] = size(X) ...

Interpolation using scattered query points

I believe the solution you point to can be trivially vectorized: load clown ; imagesc(X); colormap gray ; [nx,ny] = size(X) ...

8 dagen ago | 0

| accepted

Answered

Finding max value in intervals

Given your nicely separated peaks, I think you could simply use the 'MinPeakDistance' name-value pair, as was done in this examp...

Finding max value in intervals

Given your nicely separated peaks, I think you could simply use the 'MinPeakDistance' name-value pair, as was done in this examp...

8 dagen ago | 0

Answered

Can the following function be optimized further for speed?

The vecnorm function probably does some error- and type-checking which you don't need, and you can combine two square root opera...

Can the following function be optimized further for speed?

The vecnorm function probably does some error- and type-checking which you don't need, and you can combine two square root opera...

8 dagen ago | 1

| accepted

Answered

How to solve a 5x5 matrix in Matlab?

A\b Take a look at this documentation. Does that do what you want?

How to solve a 5x5 matrix in Matlab?

A\b Take a look at this documentation. Does that do what you want?

9 dagen ago | 0

Answered

Changing directories after a function is ran

Depending on exactly how you want to do it, I expect the following command will be useful: ls -- to see the folder contents in...

Changing directories after a function is ran

Depending on exactly how you want to do it, I expect the following command will be useful: ls -- to see the folder contents in...

10 dagen ago | 0

Answered

Creating an Array for Different Radial Positions

theta = 0; phi = pi/2; r = 1 : 0.2 : 10; theta = repmat(theta,size(r)); phi = repmat(phi, size(r)); [x,y,z] = sph2...

Creating an Array for Different Radial Positions

theta = 0; phi = pi/2; r = 1 : 0.2 : 10; theta = repmat(theta,size(r)); phi = repmat(phi, size(r)); [x,y,z] = sph2...

10 dagen ago | 0

| accepted

Answered

How do I compare each value and take the average of same number of every comparison in a vector?

Will identical values every be separated from each other? If not, then it seems like you just need unique(A) But this will not...

How do I compare each value and take the average of same number of every comparison in a vector?

Will identical values every be separated from each other? If not, then it seems like you just need unique(A) But this will not...

11 dagen ago | 0

Answered

How to make a cell array of cell arrays

Here is one way: A = 1:70; C = cell(14,1); for ii = 1:14 C{ii} = A(5*ii-4:5*ii); end To be clear on terminology (...

How to make a cell array of cell arrays

Here is one way: A = 1:70; C = cell(14,1); for ii = 1:14 C{ii} = A(5*ii-4:5*ii); end To be clear on terminology (...

11 dagen ago | 0

Answered

Find index in matrix

[tf,idx] = ismember([0 2 0],A,'rows') The output idx gives the row index. See ismember for details.

Find index in matrix

[tf,idx] = ismember([0 2 0],A,'rows') The output idx gives the row index. See ismember for details.

12 dagen ago | 0

Answered

Storing matrices value based on another matrix

Here is a straightforward algorithm: [M,N] = size(A); C = nan(max(sum(A,1)),N); for jj = 1:N row = 1; for ii = ...

Storing matrices value based on another matrix

Here is a straightforward algorithm: [M,N] = size(A); C = nan(max(sum(A,1)),N); for jj = 1:N row = 1; for ii = ...

14 dagen ago | 1

| accepted

Answered

Attempting to find patterns within my data

% The original data A = [ 8 1 2 2 4 4 5 2 1 6 1 3 1 1 1]...

Attempting to find patterns within my data

% The original data A = [ 8 1 2 2 4 4 5 2 1 6 1 3 1 1 1]...

15 dagen ago | 1

| accepted

Answered

Looping through numbers in file and adding first two numbers then next two and so on

A(1:end-1) + A(2:end)

Looping through numbers in file and adding first two numbers then next two and so on

A(1:end-1) + A(2:end)

16 dagen ago | 0

Answered

How to draw this graph using matlab code ignore the labeling

Find a similar plot at the MATLAB Plot Gallery, copy the code from there, and adapt it to your case.

How to draw this graph using matlab code ignore the labeling

Find a similar plot at the MATLAB Plot Gallery, copy the code from there, and adapt it to your case.

16 dagen ago | 1

Answered

Matrix - Vector value matching

In each iteration of the for loop, you are looking for the closest value (regardless of whether it is larger or smaller)? One wa...

Matrix - Vector value matching

In each iteration of the for loop, you are looking for the closest value (regardless of whether it is larger or smaller)? One wa...

16 dagen ago | 0

| accepted

Answered

How to check if a Database exists in MongoDB

I don't have any experience with MongoDB, but my guess is that this is not so much a MATLAB Database Toolbox question as it is a...

How to check if a Database exists in MongoDB

I don't have any experience with MongoDB, but my guess is that this is not so much a MATLAB Database Toolbox question as it is a...

16 dagen ago | 0

Answered

How to calculate the mean of 5 columns in a 12x80x250 array?

Q=Array(:,([8 13 27 45 52]),:); QMean = mean(Q,2); ArrayAndQMean = cat(2,Array,QMean); You could do it all in a one-liner...

How to calculate the mean of 5 columns in a 12x80x250 array?

Q=Array(:,([8 13 27 45 52]),:); QMean = mean(Q,2); ArrayAndQMean = cat(2,Array,QMean); You could do it all in a one-liner...

17 dagen ago | 0

| accepted

Answered

Convert double array into column vector

I'm not clear on the same point that James mentioned, but I'm going to guess that the reshape command is what you need.

Convert double array into column vector

I'm not clear on the same point that James mentioned, but I'm going to guess that the reshape command is what you need.

18 dagen ago | 0

Answered

Delete rows with bad data and surrounding rows

Here is one way. Bm2 = [ones(2,N); B(1:end-2,:)]; Bm1 = [ones(1,N); B(1:end-1,:)]; Bp1 = [B(2:end,:); ones(1,N)]; Bp2 = [B...

Delete rows with bad data and surrounding rows

Here is one way. Bm2 = [ones(2,N); B(1:end-2,:)]; Bm1 = [ones(1,N); B(1:end-1,:)]; Bp1 = [B(2:end,:); ones(1,N)]; Bp2 = [B...

22 dagen ago | 0