https://sites.google.com/site/kolukulasivasrinivas/

Professional Interests: Mathematical Computing

Answered

Question for directional derivative.

u = @(x1,x2) x1^2-x2^2 ; % derivatives at point (1, 1) x1 = 1 ; x2 = 1 ; % derivatives dudx1 = 2*x1 ; dudx2 = -2*x2 ; ...

Question for directional derivative.

u = @(x1,x2) x1^2-x2^2 ; % derivatives at point (1, 1) x1 = 1 ; x2 = 1 ; % derivatives dudx1 = 2*x1 ; dudx2 = -2*x2 ; ...

4 hours ago | 0

Answered

how to stop executing while loop?

You can set a condition like below and exit the while loop. x=1; while x<10 x = x+1 ; end

how to stop executing while loop?

You can set a condition like below and exit the while loop. x=1; while x<10 x = x+1 ; end

4 hours ago | 0

Answered

Enlarging an image with spline interpolation

I = imread("image.jpeg") ; % assuming image to m*n I=rgb2gray(I); [m,n] = size(I) ; x = 1:n ; y = 1:m ; % Inteprolate to...

Enlarging an image with spline interpolation

I = imread("image.jpeg") ; % assuming image to m*n I=rgb2gray(I); [m,n] = size(I) ; x = 1:n ; y = 1:m ; % Inteprolate to...

9 hours ago | 0

Answered

How to print all prime numbers between 1 and 100 using a for loop?

num = 1:100 ; % numbers till 100 idx = isprime(num) ; % get logical indices of prime numebrs num(idx) % print the prime ...

How to print all prime numbers between 1 and 100 using a for loop?

num = 1:100 ; % numbers till 100 idx = isprime(num) ; % get logical indices of prime numebrs num(idx) % print the prime ...

11 hours ago | 1

| accepted

Answered

Accepting and rejecting values in numeric array

A = randi(10,10,2) ; % random data for demo % Remove values greater than 8 in column 1 idx = A(:,1)>8 ; % get indices of...

Accepting and rejecting values in numeric array

A = randi(10,10,2) ; % random data for demo % Remove values greater than 8 in column 1 idx = A(:,1)>8 ; % get indices of...

11 hours ago | 0

Answered

JPEG Image Compression with a for loop

Refer this: https://in.mathworks.com/matlabcentral/answers/399622-resizing-images-using-interp1

JPEG Image Compression with a for loop

Refer this: https://in.mathworks.com/matlabcentral/answers/399622-resizing-images-using-interp1

12 hours ago | 0

Answered

Finding distance between values in a column vector

dPeakTime = diff(PeakTime) ; % get the difference between consecutive PEak times AvgPeakDistance = sum(dPeakTime)/numel(dPeakT...

Finding distance between values in a column vector

dPeakTime = diff(PeakTime) ; % get the difference between consecutive PEak times AvgPeakDistance = sum(dPeakTime)/numel(dPeakT...

12 hours ago | 0

| accepted

Answered

Interpolate NaN on graph

Read about fillmissing. https://in.mathworks.com/help/matlab/ref/fillmissing.html

Interpolate NaN on graph

Read about fillmissing. https://in.mathworks.com/help/matlab/ref/fillmissing.html

22 hours ago | 0

Answered

How to efficiently match the zeros of 1 matrix with another

If D and S are your matrices of size 26*12*160. To repalce zeros in S where D is zero, simply use: idx = D ==0 ; % get indices...

How to efficiently match the zeros of 1 matrix with another

If D and S are your matrices of size 26*12*160. To repalce zeros in S where D is zero, simply use: idx = D ==0 ; % get indices...

22 hours ago | 0

| accepted

Answered

How to modify the code below so it can loop over certain files rather then 1?

csvFiles = dir("*.csv") ; N = length(csvFiles) ; for i = 1:N XY = dlmread(csvFiles(i).name); % [xc,yc,Re,a] = c...

How to modify the code below so it can loop over certain files rather then 1?

csvFiles = dir("*.csv") ; N = length(csvFiles) ; for i = 1:N XY = dlmread(csvFiles(i).name); % [xc,yc,Re,a] = c...

23 hours ago | 1

Answered

want to read 38 csv files only first and second column?

csvFiles = dir("*.csv") ; N = length(csvFiles) ; for i = 1:N data = csvread(csvFiles(i).name) ; % also read about xlsre...

want to read 38 csv files only first and second column?

csvFiles = dir("*.csv") ; N = length(csvFiles) ; for i = 1:N data = csvread(csvFiles(i).name) ; % also read about xlsre...

24 hours ago | 0

Answered

How i can solve the this second order diffrential equation

syms y(x) c w Dy = diff(y,x) ; D2y = diff(Dy,x) ; ode = D2y-(3+2*w)*cot(x)*Dy-2*(1+w)*y==(16/3)*w*(c^2)*(cos(x)^2)+(16/...

How i can solve the this second order diffrential equation

syms y(x) c w Dy = diff(y,x) ; D2y = diff(Dy,x) ; ode = D2y-(3+2*w)*cot(x)*Dy-2*(1+w)*y==(16/3)*w*(c^2)*(cos(x)^2)+(16/...

1 day ago | 0

Answered

plotting map from a matrix

You can use pcolor. Read about it. Also have a look on surf. You can have a look on this package: https://www.eoas.ubc.ca/~ric...

plotting map from a matrix

You can use pcolor. Read about it. Also have a look on surf. You can have a look on this package: https://www.eoas.ubc.ca/~ric...

1 day ago | 0

Answered

How can I get the secondary diagonal of a matrix?

Read about diag. You can get diagonal elements by using that. A = rand(5) ; diag(A) diag(A,-1) diag(A,1) May be you are lo...

How can I get the secondary diagonal of a matrix?

Read about diag. You can get diagonal elements by using that. A = rand(5) ; diag(A) diag(A,-1) diag(A,1) May be you are lo...

1 day ago | 0

Answered

Different assignment of coordinates in meshgrid().

Let A be your 3D matrix. [m,n,p] = size(A) ; [X,Y,Z] = meshgrid(1:p,1:n,1:m) ;

Different assignment of coordinates in meshgrid().

Let A be your 3D matrix. [m,n,p] = size(A) ; [X,Y,Z] = meshgrid(1:p,1:n,1:m) ;

1 day ago | 0

Answered

How can I create unique rows in a matrix?

A = [ 0 0 0 3 6 6 4 5 6 4 6 5 5 4 6 5 5 5 5 ...

How can I create unique rows in a matrix?

A = [ 0 0 0 3 6 6 4 5 6 4 6 5 5 4 6 5 5 5 5 ...

1 day ago | 0

Answered

Figure does not display graph

Replace the lines: plot(x,y,'red') with plot(x,y,'color','red') Make these changes: plot(torque, W,'color', 'blue') %angu...

Figure does not display graph

Replace the lines: plot(x,y,'red') with plot(x,y,'color','red') Make these changes: plot(torque, W,'color', 'blue') %angu...

1 day ago | 1

| accepted

Answered

how to create a 3d plot for this matrix

Read about spy. A = randi(10,10) ; A(A>1) = 0 ; spy(A)

how to create a 3d plot for this matrix

Read about spy. A = randi(10,10) ; A(A>1) = 0 ; spy(A)

1 day ago | 0

Answered

Error: Unable to perform assignment because the left and right sides have a different number of elements.

This line: y(j)=x(j)+sigma*randn(size(j)); will create error..because, you are trying to save more number of elements then it...

Error: Unable to perform assignment because the left and right sides have a different number of elements.

This line: y(j)=x(j)+sigma*randn(size(j)); will create error..because, you are trying to save more number of elements then it...

2 days ago | 0

Answered

Making the assumption to be the same as results

ro_init=0.2:0.1:100; r = 200 ; c = 200 ; % Try increasing these values B = linspace(0,0.1,r) ; N = linspace(0.8,2,c) ; [B...

Making the assumption to be the same as results

ro_init=0.2:0.1:100; r = 200 ; c = 200 ; % Try increasing these values B = linspace(0,0.1,r) ; N = linspace(0.8,2,c) ; [B...

2 days ago | 0

| accepted

Answered

Selective summary of matrix array

Read about cumsum. https://in.mathworks.com/help/matlab/re f/cumsum.html iwant = cumsum(A) ;

Selective summary of matrix array

Read about cumsum. https://in.mathworks.com/help/matlab/re f/cumsum.html iwant = cumsum(A) ;

2 days ago | 1

| accepted

Answered

Confusion about elseif statements

The function is fine...there is one typo error..... you should use '=' not '==' function output = findtype(input); [r c] = si...

Confusion about elseif statements

The function is fine...there is one typo error..... you should use '=' not '==' function output = findtype(input); [r c] = si...

3 days ago | 0

Answered

How to find which curve fit best to another curve

To fit a polynomial read about polyfit. For curve fetting read about cftool, fit. To comapre the two curves..use the differenc...

How to find which curve fit best to another curve

To fit a polynomial read about polyfit. For curve fetting read about cftool, fit. To comapre the two curves..use the differenc...

3 days ago | 1

Answered

how to write name on plotted graph?

Read about legend. p=[123 456 344 333 667 899 565 546 688 998 765 467] T=[30 45 55 66 77 54 32 34 25 70 12 34] m=[1.00 2.00 2...

how to write name on plotted graph?

Read about legend. p=[123 456 344 333 667 899 565 546 688 998 765 467] T=[30 45 55 66 77 54 32 34 25 70 12 34] m=[1.00 2.00 2...

3 days ago | 0

Answered

How do I allocate one point only in matrix A to its closest point in matrix B

Read about knnsearch. This function will give you the number points you specified which are close. https://in.mathworks.com/he...

How do I allocate one point only in matrix A to its closest point in matrix B

Read about knnsearch. This function will give you the number points you specified which are close. https://in.mathworks.com/he...

4 days ago | 0

Answered

Finding the maximum of a vector using only for loop and the routine length

v = [ 1 5 6 23 43 5 2 5 2 23 53 45 6 3 4] ; n = length(v) ; themax = 0 ; pos = 1 ; for i = 1:n if v(i)> themax ...

Finding the maximum of a vector using only for loop and the routine length

v = [ 1 5 6 23 43 5 2 5 2 23 53 45 6 3 4] ; n = length(v) ; themax = 0 ; pos = 1 ; for i = 1:n if v(i)> themax ...

4 days ago | 0

Answered

Function function/ passing function/ varargin help?

a = 8 ; b = 0.25 ; c = 2 ; n = 180 ; f = @(t) a*exp(-b*t).*sin(t-c); t = linspace(a,b,n); y = f(t); fdiff = ma...

Function function/ passing function/ varargin help?

a = 8 ; b = 0.25 ; c = 2 ; n = 180 ; f = @(t) a*exp(-b*t).*sin(t-c); t = linspace(a,b,n); y = f(t); fdiff = ma...

4 days ago | 0

Answered

How to use previous points calculated from a function.

You can solve the given equation: R = d2*(t2-t1)/(d1-d2) ; for d2 and solve it to get d2. We have d2 as: d2 = R*d1/(R-t1+t2) ...

How to use previous points calculated from a function.

You can solve the given equation: R = d2*(t2-t1)/(d1-d2) ; for d2 and solve it to get d2. We have d2 as: d2 = R*d1/(R-t1+t2) ...

4 days ago | 0