Answered
Create a point with a number inside
th = linspace(0,2*pi) ; x = cos(th) ; y = sin(th) ; % Make numbers idx = 1:5:length(th) ; figure hold on plot(x,y,'k',...

1 month ago | 0

Answered
Pulling Vectors From 3D Matrix Based on Indicies
A = rand(30,40,10) ; iwant = squeeze(A(13,33,:))

1 month ago | 1

Answered
How to have two legends on the same plot?
figure hold on plot(rand(1,10),'r') plot(rand(1,10),'b') legend('One','Two')

1 month ago | 1

Answered
Please help, I keep getting this error... Error using plot Not enough input arguments.
Months=["Jan";"Feb";"March";"April";"May";"June";"July";"Aug";"Sept";"Oct";"Nov";"Dec"]; EnergyDailyAve = [33.677 76.714 69.6...

1 month ago | 0

Answered
Calculate area under peak
Read about the functions polyarea, trapz. Provde the (x,y) data of the curve for which you want to calculate the area.

1 month ago | 0

Answered
How to combine the data from multiple netcdf files and make it one .mat file?
%% List of files list_of_files= dir(fullfile(ddir,'*.nc')) %% Read Rainfall Data filename = fullfile(ddir, list_of_files(1).n...

1 month ago | 1

| accepted

Answered
Can anyone tell me why I'm getting an error here? "xold=xnew;'' is giving me an error in this statement and I'm not sure why.
These lines: xold=3.5; d=0.01; % Iteration 1 xold=xnew; xnew=xold-d*xold*fx(xold)/(fx(xold+d*xold)-fx(xold)); will obvious...

1 month ago | 1

| accepted

Answered
Solve the given system of equations using the Gauss-Jordan elimination method with MATLAB.
Read about rref A = [0.1 -2.5 1.2 -0.75 108 ; 2.4 1.5 -1.8 0.25 -81; 0.4 -3.2 1.6 -1.4 148.8; 1.6 1...

1 month ago | 0

Answered
data_chirp(:,:,1:2:end); what does this code mean???
It means your data i.e. data_chirp is a 3D data. That line extracts all rows, all columns at odd indices of 3rd dimension. To ...

1 month ago | 0

| accepted

Answered
How to find largest Peak Values of signal and Save X,Y Values in MATLAB
Read about the function max, findpeaks. The above functions gives you index of the max value, using this index you can get x-v...

1 month ago | 1

Answered
How to plot cluster group by circles
You may fit a circle to the cluster data using the following fileexchange function. https://in.mathworks.com/matlabcentral/fil...

1 month ago | 0

| accepted

Answered
How do I onehotencode a table without encoding variable names?
B = table(); for i = 1:size(MyTable,2) B = [B, onehotencode(MyTable.(i))]; end You may consider using width instead of s...

1 month ago | 0

Answered
How to create 4D array of images
Say you have n images each of size p,q. data = zeros(p,q,1,n) ; for i = 1:n data(:,:,1,i) = image1 ; % loop for each i...

1 month ago | 1

Answered
sum() missing for certain values
Don't use sum(Vector==x) use tol = 0.0001 ; % set your acceptable tolerance sum(abs(Vector-x)<tol) ;

1 month ago | 0

| accepted

Answered
plotting data from multiple sheets by ID and day
fname = 'https://in.mathworks.com/matlabcentral/answers/uploaded_files/1300500/RLC_AD.xlsx' ; sheets = sheetnames(fname) ; ...

1 month ago | 0

| accepted

Answered
Preallocating an array or a vector in matlab before a for loop
Thanks is accepting and/or voting the answer. :)

1 month ago | 0

Answered
Preallocating an array or a vector in matlab before a for loop
N = 24 ; sigma_infty = zeros(6,N); eps_infty = zeros(6,N); for k = 1:N % sigma_infty(:,k) = [10*k 0 0 0 0 0]'; ...

1 month ago | 1

| accepted

Answered
im modelling for two mass drive train , i could not able to know why an index exceed error
function dy= two_mass2(ta,te,k,d,jt,jg,y) x=y(1); y=y(2); dxdt=y(3); dydt=y(4); d2xdt2=((1./jt)*(ta-d*(dxdt-d*dydt)-k*(x-y)...

1 month ago | 0

Answered
How to compare each element of two arrays fullfilling a set condition more efficiently / quickly?
A = randi([0,5],10,1); B = randi([0,5],10,1); err = 0.5; [a,b] = meshgrid(A,B) ; idx = a<(1+err)*b & a>(1-err)*b ; r...

1 month ago | 0

| accepted

Answered
Build arrays under the for loop
R = cell(10,1) ; for i=1:10 R{i}= nonzeros(D(i,:)); end You can access by R{1},R{2},...R{10}. R is a cell array. You ...

1 month ago | 0

Answered
How to exclude/extract empty rows/columns in a table?
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1288860/test_file.txt'); % Remove empty rows idx...

2 months ago | 1

Answered
Error using tf The values of the "Numerator" and "Denominator" properties must be row vectors or cell arrays of row vectors,
Your numerator and denominator are sym class. You need to convert them to double using double. sys = tf(double(numerator) , dou...

2 months ago | 0

| accepted

Answered
How do I input names properly in a script?
height=input('enter your height in feet:'); weight=input('enter your weight in pounds:'); name=input('enter your first name:',...

2 months ago | 0

Answered
how to convert a.mat file in to png?
Read about volumeViewer load('dataset_liver_bmodes_steatosis_assessment_IJCARS.mat') I = data(1).images ; volumeViewer(I)

2 months ago | 0

Answered
How to convert symbolic output to numeric value in Symbolic Math Toolbox?
Read about double, vpasolve.

2 months ago | 0

Answered
Animate a line in polar coordinates
In your case r is comlex number which is not allowed. You need to get r as shown below. theta = 0:0.001:2*pi; R = 1 ; x = R...

2 months ago | 0

Answered
How to discretize the color in contour bar at smallest possible range?
% Make data for demo [X,Y,Z] = peaks ; vals = [0.000 0.005; 0.005 0.009 ; 0.01 0.05 ; 0.05 0.1; ...

2 months ago | 0

Answered
How to plot the graph for a given signal over a range of frequency
w = [0 pi/8 pi/4 pi/2 pi] ; n = 1 ; x = cos(w*n) ; plot(w,x)

2 months ago | 0

Answered
How to convert cell char array in Table With Column
You can use regexp to extract the data. load('Data.mat') [m,n] = size(Datawebsite) ; predictedClass = cell(m,1) ; maximum...

2 months ago | 0

| accepted

Answered
Using masking and native string functions to find the longest word in a string.
str = 'Today is a good day' ; s = strsplit(str) ; L = cellfun(@length,s) ; [val,idx] = max(L) ; longest_string = s{idx} ; f...

2 months ago | 0

Load more