Answered

Count EVEN and ODD numbers

clc; clear all ; a = input("Please enter 1st number: "); nE = 0 ; nO = 0 ; if mod(a,2)==0 disp("The 1st number is EVEN")...

Count EVEN and ODD numbers

clc; clear all ; a = input("Please enter 1st number: "); nE = 0 ; nO = 0 ; if mod(a,2)==0 disp("The 1st number is EVEN")...

14 días ago | 0

Answered

How do I create another column in a table which basically divides a T+1 / T number?

x = rand(10,1) ; y = rand(10,1) ; T = table(x,y) T.ratio = T.y./T.x

How do I create another column in a table which basically divides a T+1 / T number?

x = rand(10,1) ; y = rand(10,1) ; T = table(x,y) T.ratio = T.y./T.x

15 días ago | 0

Answered

Eliminating columns from the matrix

a=[0 12 13;0 5 4;0 9 6;0 8 9] idx = any(a)==0 ; a(:,idx)=[]

Eliminating columns from the matrix

a=[0 12 13;0 5 4;0 9 6;0 8 9] idx = any(a)==0 ; a(:,idx)=[]

15 días ago | 1

| accepted

Answered

Element change in a matrix

Let A be your matrix. B = A ; B(B<30) = 0 ; % replace < 30 to 0 B(B>=30 && B<75) = 1 ;

Element change in a matrix

Let A be your matrix. B = A ; B(B<30) = 0 ; % replace < 30 to 0 B(B>=30 && B<75) = 1 ;

15 días ago | 1

| accepted

Answered

Subtracts Two Cell Arrays to Yield a Third Array

Let C1 and C2 be two cell arrays of equal size and having same data each cell. N = length(C1) ; iwant = cell(N,1) ; for i =...

Subtracts Two Cell Arrays to Yield a Third Array

Let C1 and C2 be two cell arrays of equal size and having same data each cell. N = length(C1) ; iwant = cell(N,1) ; for i =...

15 días ago | 0

| accepted

Answered

How do we change the maximum number of parallel cores without a visual interface?

Read about preferences.

How do we change the maximum number of parallel cores without a visual interface?

Read about preferences.

15 días ago | 0

Answered

Get Two Cell Arrays To Same Size

load typevector_filtered.mat S = size(typevector_filtered{1}) ; for i = 1:length(typevector_filtered) if ~isequal(si...

Get Two Cell Arrays To Same Size

load typevector_filtered.mat S = size(typevector_filtered{1}) ; for i = 1:length(typevector_filtered) if ~isequal(si...

15 días ago | 0

| accepted

Answered

Can someone help with my syntax error

If A is your array to count number of times a number n (say 5) appears, follow: tol = 10^-5 ; idx = abs(A-n)<=tol ; nnz(idx(...

Can someone help with my syntax error

If A is your array to count number of times a number n (say 5) appears, follow: tol = 10^-5 ; idx = abs(A-n)<=tol ; nnz(idx(...

16 días ago | 0

Answered

Calculate frequency for each gridded

Let A be your matrix/ grid. idx = A<-1 & A>-3 ; A(idx) = 1 ; A(~idx) = 0 ; nnz(A==1) nnz(A==0)

Calculate frequency for each gridded

Let A be your matrix/ grid. idx = A<-1 & A>-3 ; A(idx) = 1 ; A(~idx) = 0 ; nnz(A==1) nnz(A==0)

18 días ago | 1

| accepted

Answered

error in plotting graph

Replace the line: plot(tspan,x(:,2),'r',tspan,y_cap(:,2),'b--','LineWidth',2.5) with plot(tspan,x(:,2),'r',tspan,y_cap,'b--'...

error in plotting graph

Replace the line: plot(tspan,x(:,2),'r',tspan,y_cap(:,2),'b--','LineWidth',2.5) with plot(tspan,x(:,2),'r',tspan,y_cap,'b--'...

18 días ago | 0

| accepted

Answered

how to get complex plot img and real

a = rand(10,1)+1i*rand(10,1) ; % complex number for demo figure plot(a) ; % this will plot real part vs complex part The...

how to get complex plot img and real

a = rand(10,1)+1i*rand(10,1) ; % complex number for demo figure plot(a) ; % this will plot real part vs complex part The...

19 días ago | 0

Answered

remove single outliers from vector

x=[ 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 ]; y = [ 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 ...

remove single outliers from vector

x=[ 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 ]; y = [ 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 ...

19 días ago | 0

| accepted

Answered

Re-arranging row of a matrix in array.

A = [2, 5, -3, 10]; B = [3, 1, 4, 2]; [A,idx] = sort(A) B = B(idx)

Re-arranging row of a matrix in array.

A = [2, 5, -3, 10]; B = [3, 1, 4, 2]; [A,idx] = sort(A) B = B(idx)

19 días ago | 0

| accepted

Answered

How to fix error about interp1?

x = b(:,1) ; y = b(:,2) ; xi = linspace(min(x),max(x),4095)' ; ai_b = interp1(x,y,xi);

How to fix error about interp1?

x = b(:,1) ; y = b(:,2) ; xi = linspace(min(x),max(x),4095)' ; ai_b = interp1(x,y,xi);

20 días ago | 1

Answered

How to sort chunks of data file in descending order

Read the data using readtable and then use function sort.

How to sort chunks of data file in descending order

Read the data using readtable and then use function sort.

20 días ago | 0

| accepted

Answered

How can I get a position of a value from an array, and the same position in another array?

You have straight functions to achieve this. REad about ismember and knnsearch.

How can I get a position of a value from an array, and the same position in another array?

You have straight functions to achieve this. REad about ismember and knnsearch.

20 días ago | 0

| accepted

Answered

How to remove image margins

Let I be your image and say you want to extract image from row0 to row1 and col0 to col1.. I_extract = I(row0:row1,col0:col1,:)...

How to remove image margins

Let I be your image and say you want to extract image from row0 to row1 and col0 to col1.. I_extract = I(row0:row1,col0:col1,:)...

21 días ago | 1

Answered

Combining charts for comparison

if true fig = figure(10); ax = axes(fig); xlabel('\tau'); ylabel(' \Psi(0,\tau)'); title('Injection rate vs. K, C'); h1 = ...

Combining charts for comparison

if true fig = figure(10); ax = axes(fig); xlabel('\tau'); ylabel(' \Psi(0,\tau)'); title('Injection rate vs. K, C'); h1 = ...

21 días ago | 0

| accepted

Answered

How to keep TRUE if followed by FALSE but if TRUE is followed by TRUE, change the second TRUE to false?

a = round(rand(100,1)) ; b = a ; for i = 2:length(a) if a(i-1)==1 && a(i)==1 b(i) = 0 ; end end

How to keep TRUE if followed by FALSE but if TRUE is followed by TRUE, change the second TRUE to false?

a = round(rand(100,1)) ; b = a ; for i = 2:length(a) if a(i-1)==1 && a(i)==1 b(i) = 0 ; end end

21 días ago | 0

| accepted

Answered

How Do I calculate the Dew Point from the Temperature and Relative Humidity. The equation I need to use is: Td = T - ((100 - RH)/5.)

If X, Z are your Temperature and Relative Humidity arrays, use: Td = X-((100 - Z)/5.) ;

How Do I calculate the Dew Point from the Temperature and Relative Humidity. The equation I need to use is: Td = T - ((100 - RH)/5.)

If X, Z are your Temperature and Relative Humidity arrays, use: Td = X-((100 - Z)/5.) ;

21 días ago | 0

Answered

Extract positive numbers from matrix to matrix

P = M(M>0) ; % where M is your matrix

Extract positive numbers from matrix to matrix

P = M(M>0) ; % where M is your matrix

22 días ago | 0

| accepted

Answered

Is there a way to adaptively sample 2-D surfaces ?

z = @(x,y) 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2)- 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) - 1/3*exp(-(x+1).^2 - y.^2); m = 100 ;...

Is there a way to adaptively sample 2-D surfaces ?

z = @(x,y) 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2)- 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) - 1/3*exp(-(x+1).^2 - y.^2); m = 100 ;...

22 días ago | 0

Answered

pulling array values using min values from separate array

REad about min function, it also give you the index/ location of the minimum value. A = [1, 4, 7, 10] ; B = [4, 5, 1, 8] ; [...

pulling array values using min values from separate array

REad about min function, it also give you the index/ location of the minimum value. A = [1, 4, 7, 10] ; B = [4, 5, 1, 8] ; [...

22 días ago | 0

| accepted

Answered

Derivation of sin(x) gives false cos(x)

t = 0.05; x = 0:0.05:2*pi; y = sin(x); figure(1) plot(x,y,'r') xlabel('time') ylabel('distance') %% vel = gradient(y...

Derivation of sin(x) gives false cos(x)

t = 0.05; x = 0:0.05:2*pi; y = sin(x); figure(1) plot(x,y,'r') xlabel('time') ylabel('distance') %% vel = gradient(y...

22 días ago | 0

| accepted

Answered

k means clustering using k=4

I = imread('Mandril.jpeg') ; I = im2double(I); R = I(:,:,1); R = R(:); G = I(:,:,2); G = G(:); B = I(:,:,3); B = B(:); idx...

k means clustering using k=4

I = imread('Mandril.jpeg') ; I = im2double(I); R = I(:,:,1); R = R(:); G = I(:,:,2); G = G(:); B = I(:,:,3); B = B(:); idx...

22 días ago | 0

| accepted

Answered

How do I find cluster center of each cluster gained from Spectral Clustering?

As you have indices in hand, you can get the centers.... clear clc load('xi.mat'); K=100; [idx]=spectralcluster(xi, K); C ...

How do I find cluster center of each cluster gained from Spectral Clustering?

As you have indices in hand, you can get the centers.... clear clc load('xi.mat'); K=100; [idx]=spectralcluster(xi, K); C ...

22 días ago | 0

| accepted

Answered

Plot error: index in position 1 is invalid

This line: plot(t,Psi(0,t),'bo--','linewidth',2,'markerfacecolor','b') t is a scalar value first i.e. t = 1.1000e-06; and Psi ...

Plot error: index in position 1 is invalid

This line: plot(t,Psi(0,t),'bo--','linewidth',2,'markerfacecolor','b') t is a scalar value first i.e. t = 1.1000e-06; and Psi ...

22 días ago | 0

| accepted

Answered

How to convert RGB gcf to grayscale gcf ?

h = rand(10) heatmap(h) ; colormap(gray)

How to convert RGB gcf to grayscale gcf ?

h = rand(10) heatmap(h) ; colormap(gray)

22 días ago | 0

| accepted