Answered
How can we order nodes within a cluster based on the distance between nodes and cluster head with smaller index values to the nearer nodes.
You can get the nearest points to a given point using knnsearch. Read about the function.

4 years ago | 0

Answered
Find the area of the region bounded by the curves y = x^2 , x = y - 2 in the first quadrant. Please help me guys, please
syms x y1 = x*x; y2 = x + 2; % GEt the intersection point of two curves xi = solve(y1-y2); yi(1) = double(subs(y1,xi(1)));...

4 years ago | 0

| accepted

Answered
Variable change at every time step
When you are not sure of size b, you can save them into a cell array. a = cell(1000,1) ; for i = 1 :1000 a{i} = b ; end...

4 years ago | 0

| accepted

Answered
create multiple heatmaps from all xyz files in my folder
d=dir(fname); % fname includes my path for n=1:length(d) if ~d.isdir(n) filename = fullfile(d(n).folder,d(n).name) ; ...

4 years ago | 0

Answered
Convert .mat files to csv file
matFiles = dir('*.mat'); N = length(matFiles) ; for i = 1:N thisFile = matFiles(i).name ; load(thisFile) ; % Do...

4 years ago | 0

| accepted

Answered
segmenting the lung region
rgbImage = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/858110/image.jpg') ; % Removing the extra whit...

4 years ago | 1

Answered
give me solution for working in a matrix of image
You need not to use a loop to find a specific value pixel. You can use == and then count the pixel. I = imread('peppers.png')...

4 years ago | 0

| accepted

Answered
knn search method for retrival
The methods available are: 'euclidean' (default) 'seuclidean' 'cityblock' 'chebychev' 'minkowski' 'mahalanobis' 'cosin...

4 years ago | 0

| accepted

Answered
for loop involving matrix with 3 indices
It looks like your RHS matrix is 2D and not 3D. Check your RHS matrix from which you are trying to extract elements. A = rand(2...

4 years ago | 0

| accepted

Answered
Read CSV with yyyyMMddhhmmss and group months
Read about datevec. This will split the date into year, month, days etc.....from this you can apply the function unique and get ...

4 years ago | 0

Answered
How to save variables in txt files while running in a loop
clc clear all close all n=10; for i=1:1:n for j=1:1:50 V(i,j)=j^2+2*(i+1); end end dlmwrite('fi...

4 years ago | 0

Answered
im finding error in line 18
Note that the index of array starts from 1 in MATLAB. You have used index as 0, so error. Also the logic you have used is not ...

4 years ago | 0

Answered
Create index vector from grouping variable based on a condition
x = [0 0.5 0.6 1 -0.03 -0.6 -0.8 0 0]' ; y = zeros(size(x)) ; y(x<0) = -1 ; y(x>0) = +1 ; T = table(x,y)

4 years ago | 0

| accepted

Answered
Unrest cell of cells
test_cell={{1,2,3};{2,3,4}}; reshape([test_cell{:}],3,2)'

4 years ago | 0

| accepted

Answered
Is it possible to do visualize the decision surface for four groups of data by using three variables?
You may refer this link to do the same: https://in.mathworks.com/matlabcentral/answers/407736-plot-3d-hyperplane-from-fitcsvm-re...

4 years ago | 0

Answered
Finding a position of minimum value element in a matrix
A = rand(10,73) ; [iwant,idx] = min(A(:,13:20),[],2) % idx gives column position

4 years ago | 0

Answered
Making a simple flower
@John D'Errico I have seen this question whence asked. Worked on it yesterday and could not upload that time and left home from ...

4 years ago | 0

Answered
How to fix the mapping between colors and values?
x = randi([0 3],10,10); % from 0 to 3 y = randi([0 2],10,10); % from 0 to 2 z = randi([0 1],10,10); % from 0 to 1 cmap= [0 ...

4 years ago | 0

Answered
Problem with the legend command
%% Initialize Input K = 1000000000; % Carrying Capacity of Brain Tumor C0 = 40000; % Initial Brain Tumor Population Size r = ...

4 years ago | 0

| accepted

Answered
How to read text file and plot scatter plot in matlab
To load the data into MATLAB workspace read about load, readmatrix, importdata. You can use any of these function. Your text f...

4 years ago | 0

| accepted

Answered
I get an error and what caused it? - Function Plotting
Are you looking for this? x = -5:0.1:5; y = ((2.*cos(x)+exp(-0.4.*x))./(0.2.*x+exp(-0.2.*x))) + ((4.*x)./3); plot(x,y);

4 years ago | 1

| accepted

Answered
program is not working
This line will not creat any array, it is empty. So loop will not run and the required variables in the plot command are not def...

4 years ago | 0

Answered
How to reshape matrix without repeating values of matrix?
A = [2 5 4 3 1 6 7 8]; [m,n] = size(A) ; iwant = zeros(m,m) ; iwant(:,1) = A(:,1) ; f...

4 years ago | 0

| accepted

Answered
How to use for loop to read the value of each row of a matrix
Read about for loop and matlab indexing. It is an easy task. % EXample demo A = rand(3,4) ; [m,n] = size(A) ; for i = 1:m ...

4 years ago | 0

| accepted

Answered
How can I extract the x value corresponding to the given y value from linear fit ?
x= [0.500 0.310 0.220 0.125 0.065] ; y= [100 95.4 63.3 36.8 22.4] ; % USe polyfit p = polyfit(y,x,1) ; xi = polyval(p,80)

4 years ago | 0

| accepted

Answered
Create and Save a time varying animation of x-y position
You can save animation into a gif file using the below link: https://in.mathworks.com/matlabcentral/answers/94495-how-can-i-cre...

4 years ago | 0

Answered
How would I find the sum of the following:
% 1 −1/2 + 1/3 −1/4 + 1/5 −1/6 + 1/7 ⋯1/x x = 10 ; i = 1./(1:x) ; i(2:2:end) = -i(2:2:end) ; iwant = sum(i)

4 years ago | 0

Answered
How can I solve the error for plot?
clc; clear all ; %% Initialize Input K = 1*(10^-9); % Carrying Capacity of Brain Tumor C0 = 40000; % Initial Brain Tumor Popu...

4 years ago | 0

Answered
Rerun specified line in m-file MATLAB
p = input('Enter the plaintext : ','s'); p = lower(p); pl = length(p); k = input('Enter the key '); while gcd(k,26)~=1 ...

4 years ago | 0

| accepted

Answered
Need a column vector from ode45, but I keep getting a struct
Read about structures. k3 = 0.1; tspan = 0:100; C0 = 0.6; dCadt = @(t,Ca) (-k3.*Ca.^3); ode_solver = ode45(dCadt, tspan,...

4 years ago | 0

| accepted

Load more