Answered

storing function outputs from a nested for loop

maxDisp_x=cell(Nrt,lhsN,NGM); for scenario=1:Nsnro for i=1:Nrt ....... for j=1:lhsN ......

storing function outputs from a nested for loop

maxDisp_x=cell(Nrt,lhsN,NGM); for scenario=1:Nsnro for i=1:Nrt ....... for j=1:lhsN ......

3 meses ago | 0

| accepted

Answered

find t and Use a graphical method to locate the initial estimate

syms t ; v = 4.8626; w = 4.4721; x=0.17; f = x - t*v*exp(-w*t)==0 ; s = double(solve(f)) ;

find t and Use a graphical method to locate the initial estimate

syms t ; v = 4.8626; w = 4.4721; x=0.17; f = x - t*v*exp(-w*t)==0 ; s = double(solve(f)) ;

3 meses ago | 0

Answered

Bug in matrix indexing?

USe this: test = 1.0e+03 *[1.1506 -0.0094 -0.0043 -0.0012 -0.0001 -0.0007 0.0003 0.0004 -0.0082 0.0...

Bug in matrix indexing?

USe this: test = 1.0e+03 *[1.1506 -0.0094 -0.0043 -0.0012 -0.0001 -0.0007 0.0003 0.0004 -0.0082 0.0...

3 meses ago | 0

Answered

Difference and probability in plot

thedifference=-5:1:5 ; N = length(thedifference) ; probability=zeros(N,1) ; for i = 1:N thediff = thedifference(i) ;...

Difference and probability in plot

thedifference=-5:1:5 ; N = length(thedifference) ; probability=zeros(N,1) ; for i = 1:N thediff = thedifference(i) ;...

3 meses ago | 0

| accepted

Answered

A statement under "for" gets skipped during the last loop

YOu are changing the loop index ii inside the if...else statements.......that is now allowed... function coded = caesar (v,s) ...

A statement under "for" gets skipped during the last loop

YOu are changing the loop index ii inside the if...else statements.......that is now allowed... function coded = caesar (v,s) ...

3 meses ago | 0

Answered

I want to load multiple text files into variable cell array

files = dir('*.txt') ; N = length(files) ; iwant = cell(N,1) ; for i = 1:N filename = files(i).name ; startRow ...

I want to load multiple text files into variable cell array

files = dir('*.txt') ; N = length(files) ; iwant = cell(N,1) ; for i = 1:N filename = files(i).name ; startRow ...

3 meses ago | 1

| accepted

Answered

How can we make a rhombus in the middle?

Play with the points in R....you give the vertices of vertices..you will get it. fr=zeros(512,512); % Rhombus points R = ...

How can we make a rhombus in the middle?

Play with the points in R....you give the vertices of vertices..you will get it. fr=zeros(512,512); % Rhombus points R = ...

3 meses ago | 0

| accepted

Answered

linear interpolation without meshgrid

Read this: https://in.mathworks.com/help/matlab/ref/scatteredinterpolant.html

linear interpolation without meshgrid

Read this: https://in.mathworks.com/help/matlab/ref/scatteredinterpolant.html

3 meses ago | 0

| accepted

Answered

How can I put two noises in an image?

How about imshow((tp+k)/2)

How can I put two noises in an image?

How about imshow((tp+k)/2)

3 meses ago | 0

| accepted

Answered

How can I place a quiver plot on top of a triangular surface (trisurf) plot?

USe 2D plot: patch('faces',tri(:,2:4),'vertices',[Xp' Yp'],'facevertexcdata',z','facecolor','interp','edgecolor','none') ; ...

How can I place a quiver plot on top of a triangular surface (trisurf) plot?

USe 2D plot: patch('faces',tri(:,2:4),'vertices',[Xp' Yp'],'facevertexcdata',z','facecolor','interp','edgecolor','none') ; ...

3 meses ago | 1

| accepted

Answered

how to get variable value in plot automatically

x = 0:10 ; figure hold on for i = 1:3 y = i*x ; plot(x,y) end legend OR x = 0:10 ; figure hold on for i =...

how to get variable value in plot automatically

x = 0:10 ; figure hold on for i = 1:3 y = i*x ; plot(x,y) end legend OR x = 0:10 ; figure hold on for i =...

3 meses ago | 0

Answered

How can I compare a set of variables?

x1= 1; x2= 3; x3= 4; x4= 3; x5= 3; x6= 1; x7=2; x = [x1 x2 x3 x4 x5 x6 x7] ; [c,ia,ib] = unique(x) ; iwant = cell(le...

How can I compare a set of variables?

x1= 1; x2= 3; x3= 4; x4= 3; x5= 3; x6= 1; x7=2; x = [x1 x2 x3 x4 x5 x6 x7] ; [c,ia,ib] = unique(x) ; iwant = cell(le...

3 meses ago | 0

Answered

location of logical matrix

Read about ismember idx = round(rand(10,2)) ; vec = [1 1] ; [c,ia] = ismember(idx,vec,'rows') ; iwant = find(c) ; idx(...

location of logical matrix

Read about ismember idx = round(rand(10,2)) ; vec = [1 1] ; [c,ia] = ismember(idx,vec,'rows') ; iwant = find(c) ; idx(...

3 meses ago | 0

Answered

comparing two data sets and extract specific data from one of them

YOu can make your blue lines a closed polygon.......and use inpolygon to get the points lying inside and on the blue lines. Read...

comparing two data sets and extract specific data from one of them

YOu can make your blue lines a closed polygon.......and use inpolygon to get the points lying inside and on the blue lines. Read...

3 meses ago | 0

| accepted

Answered

symbolic derivative with respect to time

syms x(t) f = sin(x(t)) diff(f,t)

symbolic derivative with respect to time

syms x(t) f = sin(x(t)) diff(f,t)

3 meses ago | 1

| accepted

Answered

How to change non zero value into 0?

If A is your matrix. To get non-zero indices use: idx = A>0 ; To replace them to zero use: A(idx) = 0 ;

How to change non zero value into 0?

If A is your matrix. To get non-zero indices use: idx = A>0 ; To replace them to zero use: A(idx) = 0 ;

3 meses ago | 0

Answered

can we use Xlswrite in symbolic variables?

syms x_1 y_1 A_sym = sym(zeros(2,2)); A_sym(1,1) = x_1; A_sym(2,1) = x_1 * y_1 ; A_sym(2,2) = y_1; sym_cell = arrayfun...

can we use Xlswrite in symbolic variables?

syms x_1 y_1 A_sym = sym(zeros(2,2)); A_sym(1,1) = x_1; A_sym(2,1) = x_1 * y_1 ; A_sym(2,2) = y_1; sym_cell = arrayfun...

3 meses ago | 1

| accepted

Answered

make the image to smallest 8*8 blocks

Refer here: https://in.mathworks.com/matlabcentral/answers/362262-i-have-a-32-32-matrix-i-want-to-take-mean-of-each-4-4-so-tha...

make the image to smallest 8*8 blocks

Refer here: https://in.mathworks.com/matlabcentral/answers/362262-i-have-a-32-32-matrix-i-want-to-take-mean-of-each-4-4-so-tha...

3 meses ago | 0

| accepted

Answered

How to create multiple .dat files using matlab?

for i = 1:10 filename = strcat(num2str(i),'.dat') end

How to create multiple .dat files using matlab?

for i = 1:10 filename = strcat(num2str(i),'.dat') end

3 meses ago | 0

Answered

How to find avergae of thresholded elements only from a matrix?

Let A be your matrix......say you want values below a threshold val. idx = A<val ; themean = mean(A(idx)) ;

How to find avergae of thresholded elements only from a matrix?

Let A be your matrix......say you want values below a threshold val. idx = A<val ; themean = mean(A(idx)) ;

3 meses ago | 2

| accepted

Answered

How can I interpolate with a Matrix and a Vector to another vector?

YOu see, you cannot use Enthalpy as you have used, because it is not a valid meshgrid. Reather, you can treat the data as scatte...

How can I interpolate with a Matrix and a Vector to another vector?

YOu see, you cannot use Enthalpy as you have used, because it is not a valid meshgrid. Reather, you can treat the data as scatte...

3 meses ago | 0

Answered

Surface plots inside loop

YOu can follow a samll demo code given here: [X,Y,Z] = peaks(100) ; surf(X,Y,Z) %% Make surface discontinuous for demo id...

Surface plots inside loop

YOu can follow a samll demo code given here: [X,Y,Z] = peaks(100) ; surf(X,Y,Z) %% Make surface discontinuous for demo id...

3 meses ago | 0

Answered

find slope sign change of emg signal

If (t,x) is your time and signal. dt = diff(t) ; dx = diff(x) ; slope = dx./dt ; slope_sign = sign(slop) ;

find slope sign change of emg signal

If (t,x) is your time and signal. dt = diff(t) ; dx = diff(x) ; slope = dx./dt ; slope_sign = sign(slop) ;

3 meses ago | 0

Answered

Find datetime in a vector

Use ismember Or idx = knnsearch(datenum(t_ref),datenum(t1)) ; t_ref(idx) t1 Or dt = abs((datenum(t_ref)-datenum(t1))) ;...

Find datetime in a vector

Use ismember Or idx = knnsearch(datenum(t_ref),datenum(t1)) ; t_ref(idx) t1 Or dt = abs((datenum(t_ref)-datenum(t1))) ;...

3 meses ago | 0

| accepted

Answered

convert block cell to image

Let I be your 8*8 cell block .. iwant = cell2mat(I) ;

convert block cell to image

Let I be your 8*8 cell block .. iwant = cell2mat(I) ;

3 meses ago | 0

Answered

Moving a Polygon on a Polygon

pgon = polyshape([440 0 0 440], [0 0 5.1 5.1]); path = [1:5:100 100:-5:1] ; for i = path pgon2 = polyshape([18 0 0 18]+i...

Moving a Polygon on a Polygon

pgon = polyshape([440 0 0 440], [0 0 5.1 5.1]); path = [1:5:100 100:-5:1] ; for i = path pgon2 = polyshape([18 0 0 18]+i...

3 meses ago | 1

| accepted

Answered

How do I solve backslash issue in this case?

Replace this line: filename = strcat(selpath,imageFolder(i).name); with: filename = fullfile(selpath,imageFolder(i).name); I...

How do I solve backslash issue in this case?

Replace this line: filename = strcat(selpath,imageFolder(i).name); with: filename = fullfile(selpath,imageFolder(i).name); I...

3 meses ago | 2

| accepted

Answered

"Warning: Name is nonexistent or not a directory: " Error Message if I enter the path of a file I want to import

thepath = '' ; % copy your path here in quotations filename = '' ; % give your file name in quotations with extension the...

"Warning: Name is nonexistent or not a directory: " Error Message if I enter the path of a file I want to import

thepath = '' ; % copy your path here in quotations filename = '' ; % give your file name in quotations with extension the...

3 meses ago | 0

| accepted

Answered

Finding location of minimum in 3d array

It is asked multiple times..you may search in the forum. For EXample: https://in.mathworks.com/matlabcentral/answers/52341-min...

Finding location of minimum in 3d array

It is asked multiple times..you may search in the forum. For EXample: https://in.mathworks.com/matlabcentral/answers/52341-min...

3 meses ago | 0

| accepted