Answered
Need help with plot
You can store the variables in while loop using: iwant = zeros([],1) ; counter=1; while err>0.008 counter = counter+1 ; ...

4 years ago | 0

| accepted

Answered
Meaning of a sentence in a code
You can know it by your self. Just take a print of the values. M=3; n=0:30*M-1; m=0:29; x=sin(2*pi*0.04*n); idx = 1:M:leng...

4 years ago | 0

| accepted

Answered
how to label figure with vertex point in matlab
A = rand(1,2) ; B = rand(1,2) ; C = rand(1,2) ; P = [A;B;C;A] ; label = {'A'; 'B' ; 'C'} ; plot(P(:,1),P(:,2),'.-r') text...

4 years ago | 1

| accepted

Answered
Identify the individual sides (or boundary) of the binary image.
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/835530/image.jpeg') ; I1 = rgb2gray(I) ; I2 = im...

4 years ago | 0

Answered
How can I select several matrices out of my 4-D Double dataset?
iwant = val(:,:,:,1) ;

4 years ago | 1

Answered
Code is displaying graph but not plotting any points
plot([0,100],macheps*[1,1],'-w') It seems you are using white color for plotting. White background doesn't show up the white co...

4 years ago | 0

| accepted

Answered
detectCircleGridPoints function not found
The said function detectCircleGridPoints is introduced in 2021b. Are you using the same version? Check that. Have a look on t...

4 years ago | 0

Answered
Error using fmincon Too many input arguments
You may use scatter3 figure(1); scatter3(x(1),x(2),x(3),[],x(4),'filled');

4 years ago | 0

Answered
How to solve this error Index exceeds the number of array elements. Index must not exceed 198450. Error in quant (line 23) plot(t(zoom),Y2(zoom));
The error is simple amd striaght. You are trying to extract more number of elements than present in the array. Example: a = r...

4 years ago | 0

Answered
How to do an interpolation on a matrix?
You can convert table to array using table2array. You can access the column of table using x.(1). x=timetable2table(Accelerati...

4 years ago | 0

Answered
How to get polynomial equation of polyfit?
fprintf('%f*Year^2+%f*YEar+%f\n',pf)

4 years ago | 1

Answered
Sensor Data for look up table
T = readtable('look21 (1).xlsx') x = T.x ; y = T.y ; z = T.z ; xi = linspace(min(x),max(x)) ; yi = linspace(min(y),max(y...

4 years ago | 0

| accepted

Answered
How can I make a code to display the person's name corresponding to the number from a dice? I have to use a switch statement.
The best option is to use a table as shown below: Number = (1:6)' ; Name = { 'Jane' 'Johannes' 'Jill' 'Joyce' 'Jim' 'Jace'...

4 years ago | 0

Answered
Is there a way to simplify two for loops?
L = 1 % L = 1,2,...,7 n = (2^L+1)^2; A = rand(n); D = rand(n); B = D*A*D' ;

4 years ago | 0

| accepted

Answered
How to compare terms in column and set an if loop
You can find the difference and check when it is equal to zero and get its index. X = [1 2 3 3 4 5 6] ; d = find(diff(X)==0) ...

4 years ago | 0

Answered
Error using interp2, line226 and line126
You need to transpose the density matrix: for i=drange(1:100) P=101; result1=zeros(100); result1(i)=interp2(Pr...

4 years ago | 0

Answered
Can not get vector field
y = 0:0.1:100; x = -y; [X,Y] = meshgrid(x,y) ; quiver(X,Y)

4 years ago | 0

| accepted

Answered
converting a date into a num
You can convert dates which are in datetime class using the function datenum.

4 years ago | 0

Answered
How to process NC file in matlab
Refer this: https://in.mathworks.com/matlabcentral/answers/574741-create-a-box-around-points-and-use-in-inpolygon

4 years ago | 1

Answered
Issue while plotting the equation
z = 3+1i*2 real(z) imag(z)

4 years ago | 0

Answered
How to find the area from a Positive and negative signal plot
A = readmatrix('Data.xlsx'); t = (1:length(A))' ; % Positive Area Ap = A ; Ap(A<=0) = 0 ; trapz(t,Ap)

4 years ago | 0

| accepted

Answered
How to find values from data
You can use logical indexing. Example: A = rand(10,1) ; % data for demo idx = A > 0.3 & A < 0.8 ; idx find(idx) A(idx)

4 years ago | 1

Answered
Finding the coordinates of vortices from contour plot
[M,c] = contourf(Z); M has the coordinates you want.

4 years ago | 1

Answered
Creating a structure and fields in nested loops
You can use ismember. I don't think you need to use a loop here. T=readtable('fruitvegprices.csv'); % first column of T is ite...

4 years ago | 1

| accepted

Answered
How to find computational time?
Read about tic toc. t1 = tic ; A=[1 2 3 4 56 7 8 9]; B=[7 8 9 4 55 1 2 3]; for i=1:length(A) Add(i) = A(i)+ 2* B(i);...

4 years ago | 2

| accepted

Answered
Save array in matrix from for loop
X=xo:((xf-xo)/divnum):xf N = length(X) ; pstarA = cell(N,1) ; pstarB = cell(N,1) ; for i = 1:N x = X(i) ; % ra...

4 years ago | 0

| accepted

Answered
Event Detection on a circle
clc tspan = [0:0.05:80]; %Range for independent var. i.e. time r = 2; centreX0 = 0; centreY0 = 0; theta = 1.08; Ptheta =...

4 years ago | 0

Answered
What is a double matrix?
If it is a string, read about str2num, str2double. If it is a single, use double. If it is a sym class, use double.

4 years ago | 0

Answered
Fill Area in matlab plot
Download the function InterX from the link: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections x = ...

4 years ago | 0

| accepted

Answered
NOT ENOUGH INPUT ARGUMENTS
You might be running the function striaght away using f5 or hitting run button. You need to provide the inputs to the function a...

4 years ago | 0

Load more