Answered
How to find the closest value to the average in an array?
a = [1,2,3,4,5,6,7] ; idx = knnsearch(a',mean(a)) ; a(idx)

17 days ago | 0

Answered
How to make a function file that displays a polynomial and accepts a specific command?
val = lou(1,2,3,.2) function val = lou(a,b,c,x) fprintf('%dx^2 + %dx + %d =0 \n',a,b,c) val = a*x^2+b*x+c ; end

17 days ago | 0

Answered
How to remove points below a surface in matlab plot?
You can go by the z coordinate. Check the z coordinates and remove which ever points are lessthan the z value of the surface. ...

18 days ago | 0

|accepted

Answered
help ! how do i fix this error : Error using .* Integers can only be combined with integers of the same class, or scalar doubles.
Read about class. To multiply two variables, they should be of same class. a = int8(6) ; b = int16(6) ; c = int8(6) ; clas...

18 days ago | 0

Answered
Find connecting global maxima of a given dataset.
Have a look on findpeaks and envelope.

19 days ago | 0

Answered
How to plot cubic imagesc figure?
Read about slice, pcolor.

19 days ago | 0

Answered
How can I detect circles that on square edges?
I = imread('//www.tatmou.com/matlabcentral/answers/uploaded_files/963075/image.png') ; [R,C] = imfindcircles(I,[10 100...

19 days ago | 0

Answered
How to shift an array in graph x-axis with a certain value?
Add 30 to the x-values i.e. to the indices. a = 0; b = 360; rng('shuffle'); ncycles = 10; npoints = 1050000; r1 = sort((b-...

19 days ago | 0

Answered
How to plot the functions x=cos(t) and y=sin(t) in a single graph?
What you gave is a parametric equation of circle. You just need to use plot. Read about it. t=linspace(0,2*pi); x=cos(t); y=...

19 days ago | 0

|accepted

Answered
Store polyfit information of for loop in matrix
You may save them into a cell as well. yp = cell(floor(length(xorg)/40)*40,1); for i = 40:40:length(xorg) for j = 1:floo...

20 days ago | 0

Answered
从图像中提取坐标
You can use this toolbox: https://in.mathworks.com/matlabcentral/fileexchange/7173-grabit

20 days ago | 1

|accepted

Answered
DATA Reading and Interpolation
csvFiles = dir('*.csv') ; N = length(csvFiles) ; for i = 1:N csvFile = csvFiles(i).name ; % read the file and do w...

20 days ago | 1

|accepted

Answered
creation of a histogram with RGB values (in .txt file)
data = importdata('filename.txt') ; h1 = histogram(data(:,1), 10); h1 = h1.Values ; h2 = histogram(data(:,2), 10); h2 = h2....

20 days ago | 0

Answered
find the coefficients a, b, and c of the quadratic polynomial. that passes through the three points (x, y)
% Convert the equation to form Ax = b P = [1, 4 ;4, 73; 5, 120] ; % points x = P(:,1) ; y = P(:,2) ; b = P(:,2) ; ...

20 days ago | 1

Answered
Printing rows from excel sheet based on two column values
T = readtable(myfile) ; idx = matches(T.FaceDescr,'appFace://') & matches(T.Type,'InInterests') & (T.FaceID == 258) ; T(idx,:...

20 days ago | 0

|accepted

Answered
Matlab Random Word Generator
字典=“dictionary.txt”;n = 5;%的信件pick from the string Random=randperm(length(Dictionary),5); randword = D...

21 days ago | 1

|accepted

Answered
Printing specific rows based on column from excel
T = readtable(myfile) ; idx = matches(T.FaceDescr,'all') ; T(idx,:)

21 days ago | 0

|accepted

Answered
How to find the value of x when y = 0 and label on the curve?
x = 0:0.01:66.03; y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86); [val,idx] = min(abs(y)) ; plot(x,y,'c-','L...

21 days ago | 0

Answered
Subplot graph by combining two obtained graphs.
h1 = openfig('Flow_rate_clot_M.fig','reuse'); % open figure ax1 = gca; % get handle to axes of figure h2 = openfig('Flow_rate_...

21 days ago | 0

Answered
How can i break in the Y-axis for better visualization?
Try these: https://in.mathworks.com/matlabcentral/fileexchange/3668-breakaxis https://blogs.mathworks.com/pick/2008/11/21/br...

21 days ago | 0

Answered
How to manage colormap and colorbar in a matlab multi-curves plot?
Say you have 30 curves approximately. I will show these with circles. R = 1:30 ; th = linspace(0,2*pi) ; cmap = jet(30) ; ...

22 days ago | 1

|accepted

Answered
How can I generate random integers from 1 to 'n' in a jagged array(matrix of different row size) ?
Read about randperm. If you want to select 4 numbers from 1 to 15. r = randperm(15,4)

22 days ago | 0

Answered
Stuck at coding newton-Rapson method
Replace this line: f2=diff(f(x)); with f2=inline(diff(f(x)));

22 days ago | 1

Answered
Hello to all, can you help me to plot y= (x+2)^(x+2)
x = linspace(0,1) ; y = (x+2).^(x+2) ; plot(x,y)

22 days ago | 0

|accepted

Answered
a function that has two inputs: a number and a row vector
function val = myfun(a,b) if numel(a) ~= 1 | size(b,1) ~=1 error('check the inputs') ; end % Do what you want end

23 days ago | 0

Answered
How to add a row above the first row of a matrix to name each column
tc = (0:15:100)'; % tc is temperature Celsius, tf is temp deg F, tf = 1.8.*tc + 32; % and tr is temp deg Rankin. tr = tf + 459...

23 days ago | 0

Answered
How to plot the y and t?
You need to call the function. Provide the input and call the function. There is small typo in your function; it seems the input...

23 days ago | 0

|accepted

Answered
Error in plot... vectors must be same length
这些线:N=30; %no of divisions; l=30; delta_x=l/N; M(1,1)=0; N(1,1)=1; % <---- over writitng values of N Why you...

23 days ago | 0

Answered
Not enough input Arguments Error & error in Height
Note that height is a inbuilt function. You have not defined the variable height which is defined in the line: MoR = ((testload...

23 days ago | 1

Load more