Answered

plot graph, and add value

x = (1:10)' ; y = rand(size(x)) ; plot(x,y,'.r') hold on text(x,y,num2str(y))

plot graph, and add value

x = (1:10)' ; y = rand(size(x)) ; plot(x,y,'.r') hold on text(x,y,num2str(y))

12 dagen ago | 0

| accepted

Answered

How do I prelallocate this sed as there is no loop here?

When you use the way you have shown,MATLAB created a n-D zeros matrix. You need to use as shown below: uLS1 = zeros(1,N_e...

How do I prelallocate this sed as there is no loop here?

When you use the way you have shown,MATLAB created a n-D zeros matrix. You need to use as shown below: uLS1 = zeros(1,N_e...

12 dagen ago | 0

Answered

Area under distribution fit curve

Let Y be your 261345x1 data. X = (1:length(Y))' ; trapz(X,Y)

Area under distribution fit curve

Let Y be your 261345x1 data. X = (1:length(Y))' ; trapz(X,Y)

12 dagen ago | 0

Answered

I want to find the inverse of my function 'mag' and plot it as 'mag1'

Inverse of mag = sin(3*theta); Would be: theta = asin(mag)/3 ;

I want to find the inverse of my function 'mag' and plot it as 'mag1'

Inverse of mag = sin(3*theta); Would be: theta = asin(mag)/3 ;

12 dagen ago | 0

| accepted

Answered

save multiple plots in user specified folder in jpg form

Read about saveas. After the plot you can use: saveas(gcf,'Figure1.jpg')

save multiple plots in user specified folder in jpg form

Read about saveas. After the plot you can use: saveas(gcf,'Figure1.jpg')

12 dagen ago | 0

Answered

Why matrix return all 'false/0' when there are a lot of similar values between matrix and a column vector?

You should not compare the floting point numbers like that. You should check the difference between them to be less than some to...

Why matrix return all 'false/0' when there are a lot of similar values between matrix and a column vector?

You should not compare the floting point numbers like that. You should check the difference between them to be less than some to...

12 dagen ago | 0

| accepted

Answered

Simple question for using 'for loop'

a = zeros([],1) ; c = 0 ; for n = 1:2:10 %This is my homework request.I can't change this. c = c+1 ; a(c) = 2^n ; ...

Simple question for using 'for loop'

a = zeros([],1) ; c = 0 ; for n = 1:2:10 %This is my homework request.I can't change this. c = c+1 ; a(c) = 2^n ; ...

13 dagen ago | 0

Answered

Plotting random numbers in histogram and bin allocation.

You have striaght away functions to achieve what you want. Read about histogram, mean, std.

Plotting random numbers in histogram and bin allocation.

You have striaght away functions to achieve what you want. Read about histogram, mean, std.

13 dagen ago | 0

| accepted

Answered

Need help to get the minimum absolute value of intersection point

Use this file exchange: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

Need help to get the minimum absolute value of intersection point

Use this file exchange: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

14 dagen ago | 0

| accepted

Answered

How to plot third variable in a 2d plot?

If you have a plane, read about pcolor, surf, patch. If you have a curve read about scatter. If not share your data and tell...

How to plot third variable in a 2d plot?

If you have a plane, read about pcolor, surf, patch. If you have a curve read about scatter. If not share your data and tell...

15 dagen ago | 1

Answered

How to compare rows of a matric?

A = rand(1,3) ; % your row B = rand(3) ; % Say complete matrix idx = A > B ; % comapre r = find(sum(idx,2)==3) % find...

How to compare rows of a matric?

A = rand(1,3) ; % your row B = rand(3) ; % Say complete matrix idx = A > B ; % comapre r = find(sum(idx,2)==3) % find...

15 dagen ago | 0

| accepted

Answered

summation of answers received in a "for" loop

t_liner=1.5 ; t1 = zeros(5,1) ; t2 = zeros(5,1) ; t_layer = zeros(5,1) ; t_total = zeros(5,1) ; for i=1:5 if rem(i,...

summation of answers received in a "for" loop

t_liner=1.5 ; t1 = zeros(5,1) ; t2 = zeros(5,1) ; t_layer = zeros(5,1) ; t_total = zeros(5,1) ; for i=1:5 if rem(i,...

15 dagen ago | 0

| accepted

Answered

Is there a way to exclude variables from a string array after they've been chosen using menu function?

Read about setdiff. Or use strcmp get the position and remove the string.

Is there a way to exclude variables from a string array after they've been chosen using menu function?

Read about setdiff. Or use strcmp get the position and remove the string.

15 dagen ago | 0

| accepted

Answered

Need To Find Value of Y at X for Curve Z. Detail Problem Explained in description

Read about knnsearch, you provide (Y,Z) data and for a given (y,z) find which point is closest, get the index and assign the res...

Need To Find Value of Y at X for Curve Z. Detail Problem Explained in description

Read about knnsearch, you provide (Y,Z) data and for a given (y,z) find which point is closest, get the index and assign the res...

15 dagen ago | 0

Answered

Problem with Interpolation function involving 2 variables

T = readtable('xyz.xlsx') ; x = T.X ; y = T.Y ; z = T.Z; Xq = -60:60 ; Yq = -160:160. ; [Xq,Yq] = meshgrid(Xq,Yq...

Problem with Interpolation function involving 2 variables

T = readtable('xyz.xlsx') ; x = T.X ; y = T.Y ; z = T.Z; Xq = -60:60 ; Yq = -160:160. ; [Xq,Yq] = meshgrid(Xq,Yq...

16 dagen ago | 0

Answered

why do I receive "Index in position 1 is invalid. Array indices must be positive integers or logical values"

In MATLAB the indexing should be always positive integers and/ or logical. A = rand(1,10) ; A(1) % no error A(10) % no er...

why do I receive "Index in position 1 is invalid. Array indices must be positive integers or logical values"

In MATLAB the indexing should be always positive integers and/ or logical. A = rand(1,10) ; A(1) % no error A(10) % no er...

16 dagen ago | 0

Answered

convert for loop's answers into a vector

mean(aR2) is a scalar value, why you want to store it into a vector? Are you looking for saving values in a loop into a array?...

convert for loop's answers into a vector

mean(aR2) is a scalar value, why you want to store it into a vector? Are you looking for saving values in a loop into a array?...

16 dagen ago | 0

| accepted

Answered

Intersections between line and rectangle

Use this file exchange function: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

Intersections between line and rectangle

Use this file exchange function: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

16 dagen ago | 0

Answered

How to find (0,0) in a meshgrid?

x = -10:1:10 ; y = -5:1:5 ; [X,Y] = meshgrid(x,y) ; idx = knnsearch([X(:) Y(:)],[0 0]) ; plot(X,Y,'.r') hold on plot(...

How to find (0,0) in a meshgrid?

x = -10:1:10 ; y = -5:1:5 ; [X,Y] = meshgrid(x,y) ; idx = knnsearch([X(:) Y(:)],[0 0]) ; plot(X,Y,'.r') hold on plot(...

17 dagen ago | 0

| accepted

Answered

% 34.- Plot the surface % f(x, y) = x y e^(-x^2-y^2) % over the domain [-2; 2] × [-2; 2]. % Find the values and the locations of the minima and maxima of this function.

Read about pcolor, surf for plotting. To get minimum and maximum read about min and max respectively.

% 34.- Plot the surface % f(x, y) = x y e^(-x^2-y^2) % over the domain [-2; 2] × [-2; 2]. % Find the values and the locations of the minima and maxima of this function.

Read about pcolor, surf for plotting. To get minimum and maximum read about min and max respectively.

17 dagen ago | 0

Answered

From arrays of two columns into multiple circles

C = rand(10,2) ; plot(C(:,1),C(:,2),'o','Markersize',10) If you want circle with given radius R. C = rand(10,2) ; R = 4 ; ...

From arrays of two columns into multiple circles

C = rand(10,2) ; plot(C(:,1),C(:,2),'o','Markersize',10) If you want circle with given radius R. C = rand(10,2) ; R = 4 ; ...

17 dagen ago | 0

| accepted

Answered

how to make a spatial map with two dimensional matrix

Let X, Y, Z be your data. Where X is m*n, Y is m*n and Z is m*n*p matrix. for i = 1:p pcolor(X,Y,Z(:,:,i)) drawnow ...

how to make a spatial map with two dimensional matrix

Let X, Y, Z be your data. Where X is m*n, Y is m*n and Z is m*n*p matrix. for i = 1:p pcolor(X,Y,Z(:,:,i)) drawnow ...

17 dagen ago | 0

Answered

Why Using '%f' as formatspec for a text file containing floating numbers gives no output

data = importdata('data.txt') ; data = data.data ; t = data(:,7) ; x = data(:,17) ; y = data(:,16) ; lat = [32.48...

Why Using '%f' as formatspec for a text file containing floating numbers gives no output

data = importdata('data.txt') ; data = data.data ; t = data(:,7) ; x = data(:,17) ; y = data(:,16) ; lat = [32.48...

17 dagen ago | 0

Answered

What does C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; signify?

C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; In the above C, is 3D matrix initialized as 3*3*p matrix. Each matrix of C, sh...

What does C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; signify?

C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; In the above C, is 3D matrix initialized as 3*3*p matrix. Each matrix of C, sh...

17 dagen ago | 0

Answered

Plot a circle with the radius r = 2, % knowing that the parametric equation % of a circle is % [x(t); y(t)] = % [r cos(t); % r sin(t)] for t = [0; 2pi]

If I want to plot sine, I will follow as below: t = linspace(0,2*pi,100) ; x = sin(t) ; plot(t,x) ; Use the above as exampl...

Plot a circle with the radius r = 2, % knowing that the parametric equation % of a circle is % [x(t); y(t)] = % [r cos(t); % r sin(t)] for t = [0; 2pi]

If I want to plot sine, I will follow as below: t = linspace(0,2*pi,100) ; x = sin(t) ; plot(t,x) ; Use the above as exampl...

17 dagen ago | 2

Answered

Except for the first iteration others show NaN

Try reducing the initial learning rate. options = trainingOptions('adam') ; options.InitialLearnRate options.InitialLearnRat...

Except for the first iteration others show NaN

Try reducing the initial learning rate. options = trainingOptions('adam') ; options.InitialLearnRate options.InitialLearnRat...

18 dagen ago | 0

| accepted

Answered

Plot 3D shape with grid cell

You have variety of functions to achieve it. It depends on what data you have. I assume you have a 3D volume data i.e. matrices ...

Plot 3D shape with grid cell

You have variety of functions to achieve it. It depends on what data you have. I assume you have a 3D volume data i.e. matrices ...

18 dagen ago | 0

Answered

How to remove contour line in filled contour plot?

Try: pcolor(x,y,z) ; colorbar ; shading interp ;

How to remove contour line in filled contour plot?

Try: pcolor(x,y,z) ; colorbar ; shading interp ;

18 dagen ago | 0

Answered

How to set one specific point on a 3-D surface ?

[X,Y,Z] = peaks(100) ; [val,idx] = max(Z(:)) ; surf(X,Y,Z) ; shading interp hold on plot3(X(idx),Y(idx),Z(idx),'+r')

How to set one specific point on a 3-D surface ?

[X,Y,Z] = peaks(100) ; [val,idx] = max(Z(:)) ; surf(X,Y,Z) ; shading interp hold on plot3(X(idx),Y(idx),Z(idx),'+r')

18 dagen ago | 0