Answered

how to remove the NaN values from a dataset?

Read about isnan, A = [1 2 NaN 2 NaN rand] ; idx = isnan(A) ; A(idx) = [] % remove NaNs If you try to remove NaN's from...

how to remove the NaN values from a dataset?

Read about isnan, A = [1 2 NaN 2 NaN rand] ; idx = isnan(A) ; A(idx) = [] % remove NaNs If you try to remove NaN's from...

9 dagar ago | 1

| accepted

Answered

I need to repeat a sequence 33 times

Read about repmat. A = [1 2 3] ; B = repmat(A,1,3)

I need to repeat a sequence 33 times

Read about repmat. A = [1 2 3] ; B = repmat(A,1,3)

10 dagar ago | 0

Answered

How to muliply non equal vectors with slicing?

A = 1:12; B = 1:4; A = reshape(A,4,[])' ; iwant = A.*B

How to muliply non equal vectors with slicing?

A = 1:12; B = 1:4; A = reshape(A,4,[])' ; iwant = A.*B

10 dagar ago | 0

Answered

Extracting closed contours of streamfunction

Did you try this? https://in.mathworks.com/help/matlab/ref/streamline.html

Extracting closed contours of streamfunction

Did you try this? https://in.mathworks.com/help/matlab/ref/streamline.html

10 dagar ago | 0

Answered

how to save variable as txt in a specified location with variable value appearing in the file name

path='c:/users/user/desktop'; filename = [path,filesep,'Gauss',num2str(width),'.txt']; fid = fopen(filename,'w') ; fprintf(fi...

how to save variable as txt in a specified location with variable value appearing in the file name

path='c:/users/user/desktop'; filename = [path,filesep,'Gauss',num2str(width),'.txt']; fid = fopen(filename,'w') ; fprintf(fi...

10 dagar ago | 0

Answered

How to plot 3D filled contour ?

You can plot one level at a time: for i = 1:18 plot(lon,lat,levels(:,:,i)') shading interp drawnow end If you ...

How to plot 3D filled contour ?

You can plot one level at a time: for i = 1:18 plot(lon,lat,levels(:,:,i)') shading interp drawnow end If you ...

10 dagar ago | 0

Answered

Index exceeds the number of array elements. Index must not exceed 3.

This error occurs when you try to extract more number of elements then present in the array. A = rand(1,4) ; % 1x4 array A...

Index exceeds the number of array elements. Index must not exceed 3.

This error occurs when you try to extract more number of elements then present in the array. A = rand(1,4) ; % 1x4 array A...

10 dagar ago | 0

Answered

How to downsize image in x and y direction?

Read about imresize. img = imread('img') new_img2 = imresize(img, 1/2); imshow(new_img2)

How to downsize image in x and y direction?

Read about imresize. img = imread('img') new_img2 = imresize(img, 1/2); imshow(new_img2)

10 dagar ago | 0

| accepted

Answered

How do I refer to the next y point in a function?

You need to define x as an array, when you sustitue x in the function f, you will get output array y which is of same dimension ...

How do I refer to the next y point in a function?

You need to define x as an array, when you sustitue x in the function f, you will get output array y which is of same dimension ...

10 dagar ago | 1

| accepted

Answered

How to make 3d plot to model logistic regression?

a0 = -3.936212854; a1 = 0.140718658; a2 = -0.102108952; m = 100 ; n = 100 ; C = linspace(0, 320,m); P = linspace(0, 0.58,n...

How to make 3d plot to model logistic regression?

a0 = -3.936212854; a1 = 0.140718658; a2 = -0.102108952; m = 100 ; n = 100 ; C = linspace(0, 320,m); P = linspace(0, 0.58,n...

10 dagar ago | 1

Answered

How do I plot this beam, given the coordinates, distances between the nodes, and the connections, and the lengths of each segment?

Read about delaunayTriangulation. This would be easy to use to plot the shown. https://in.mathworks.com/help/matlab/ref/delaun...

How do I plot this beam, given the coordinates, distances between the nodes, and the connections, and the lengths of each segment?

Read about delaunayTriangulation. This would be easy to use to plot the shown. https://in.mathworks.com/help/matlab/ref/delaun...

10 dagar ago | 0

Answered

Making all Elements in Matrix Even.

a=[53, 59, 61, 87] ; iwant = a+mod(a,2)

Making all Elements in Matrix Even.

a=[53, 59, 61, 87] ; iwant = a+mod(a,2)

10 dagar ago | 0

Answered

Retain all initial even value elements, add all odd values with 1

Hint: Read about mod. If mod(x,2) is 1 then x is odd. mod(4,2) % even number mod(5,2) % odd number

Retain all initial even value elements, add all odd values with 1

Hint: Read about mod. If mod(x,2) is 1 then x is odd. mod(4,2) % even number mod(5,2) % odd number

11 dagar ago | 0

Answered

Find position of the maximum value and then convert the row zeros and the position of the maximum value should become 1. just like in the image attach

A = rand(4) ; [m,n] = size(A) ; B = zeros(m,n) ; [val,i] = max(A,[],2) ; idx = sub2ind(size(A),(1:m)',i) ; B(idx) = ...

Find position of the maximum value and then convert the row zeros and the position of the maximum value should become 1. just like in the image attach

A = rand(4) ; [m,n] = size(A) ; B = zeros(m,n) ; [val,i] = max(A,[],2) ; idx = sub2ind(size(A),(1:m)',i) ; B(idx) = ...

11 dagar ago | 0

| accepted

Answered

Size of Q is undefined

You need to define the input variables and then call the function. It seems you are striaght away hitting the f5/ run button so ...

Size of Q is undefined

You need to define the input variables and then call the function. It seems you are striaght away hitting the f5/ run button so ...

11 dagar ago | 0

| accepted

Answered

How to find the contigous coordinate points between two varaibles datasets and do regression

idx = knnsearch(A(:,1:2),B(:,1:2)) ; B = B(idx,:) ;

How to find the contigous coordinate points between two varaibles datasets and do regression

idx = knnsearch(A(:,1:2),B(:,1:2)) ; B = B(idx,:) ;

11 dagar ago | 0

| accepted

Answered

Simple logical conditional flag column

Simple, Let C1 , C2 be your two columns. C2(C1==1)=1 ; C2(C1==-1)=0 ;

Simple logical conditional flag column

Simple, Let C1 , C2 be your two columns. C2(C1==1)=1 ; C2(C1==-1)=0 ;

11 dagar ago | 1

Answered

Problem for doing Monte Carlo Integration

Your y in the ocde is a anonymous function: function_handle with value: @(x)sin(x) You need to input some value into ...

Problem for doing Monte Carlo Integration

Your y in the ocde is a anonymous function: function_handle with value: @(x)sin(x) You need to input some value into ...

11 dagar ago | 1

| accepted

Answered

How to draw multiple plots in one picture?

subplot(411) plot(rand(100,1)) subplot(412) plot(rand(100,1)) subplot(413) plot(rand(100,1)) subplot(414) plot(rand(100,1...

How to draw multiple plots in one picture?

subplot(411) plot(rand(100,1)) subplot(412) plot(rand(100,1)) subplot(413) plot(rand(100,1)) subplot(414) plot(rand(100,1...

11 dagar ago | 1

| accepted

Answered

I want to arrange a 1st column of a matrix in descending order an the elements in the row is going to arrange itself according to change of the row of first vector

A= [3 2; 1 4; 2 6] ; [val,idx] = sort(A(:,1),'ascend') A = A(idx,:)

I want to arrange a 1st column of a matrix in descending order an the elements in the row is going to arrange itself according to change of the row of first vector

A= [3 2; 1 4; 2 6] ; [val,idx] = sort(A(:,1),'ascend') A = A(idx,:)

11 dagar ago | 1

Answered

how to write equation in matlab ?

If x is your series. N = length(x) ; FI = sum(abs(diff(x)))/N ;

how to write equation in matlab ?

If x is your series. N = length(x) ; FI = sum(abs(diff(x)))/N ;

11 dagar ago | 0

Answered

generate heat map based on lat/lon and data value

Let T be your grid... x = T.lon ; y = T.lat ; z = T.err_d ; % Convert the scattered data into grid m = 100 ; % can be...

generate heat map based on lat/lon and data value

Let T be your grid... x = T.lon ; y = T.lat ; z = T.err_d ; % Convert the scattered data into grid m = 100 ; % can be...

11 dagar ago | 1

| accepted

Answered

Reading and visualizing netcdf with vectors of differing lengths

If you want to attach the file, you can upload in some cloud spaces (google drive) and share the link here without asking the lo...

Reading and visualizing netcdf with vectors of differing lengths

If you want to attach the file, you can upload in some cloud spaces (google drive) and share the link here without asking the lo...

11 dagar ago | 0

| accepted

Answered

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

The error is clear, you are trying to save more number of elements on the LHS then it is intialized for. Example: A = zeros(3...

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

The error is clear, you are trying to save more number of elements on the LHS then it is intialized for. Example: A = zeros(3...

11 dagar ago | 0

Answered

Load Files from folder based on file number

csvFiles = dir('*.csv') ; % you are in the folder where csv files are present N = length(csvFiles) ; for i = 1:N thi...

Load Files from folder based on file number

csvFiles = dir('*.csv') ; % you are in the folder where csv files are present N = length(csvFiles) ; for i = 1:N thi...

11 dagar ago | 0

Answered

Contour plot on a surface plot

A = load('Comsol_surf.txt'); x = A(:,1); y = A(:,2); z = A(:,3); % xg = linspace(min(x),max(x),1000) ; yg = linspace(min(...

Contour plot on a surface plot

A = load('Comsol_surf.txt'); x = A(:,1); y = A(:,2); z = A(:,3); % xg = linspace(min(x),max(x),1000) ; yg = linspace(min(...

12 dagar ago | 0

Answered

how to obtain random vector from the defined matrix

c=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17]; [m,n] = size(c) idx = randsample(m,1) iwant = c(idx,:)

how to obtain random vector from the defined matrix

c=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17]; [m,n] = size(c) idx = randsample(m,1) iwant = c(idx,:)

12 dagar ago | 1

| accepted

Answered

Indexing a sub-variable in Matlab base workspace

This line: [ymin, index] = min(y); Your input to the function min is a structure. min takes an array as input. You need to cha...

Indexing a sub-variable in Matlab base workspace

This line: [ymin, index] = min(y); Your input to the function min is a structure. min takes an array as input. You need to cha...

12 dagar ago | 1

Answered

How do I save my values of x each time the loop goes round?

%IC clear x = 1; time = 0; dt = 0.1; %for loop calculating x after 10 iterations xx = zeros(10,1) ; for n = 1:10; k1...

How do I save my values of x each time the loop goes round?

%IC clear x = 1; time = 0; dt = 0.1; %for loop calculating x after 10 iterations xx = zeros(10,1) ; for n = 1:10; k1...

12 dagar ago | 0

| accepted

Answered

PSNR calculation for two photos

You have a inbuilt functions for that: Read here: https://in.mathworks.com/help/images/ref/psnr.html

PSNR calculation for two photos

You have a inbuilt functions for that: Read here: https://in.mathworks.com/help/images/ref/psnr.html

12 dagar ago | 0