Answered
How to create an array from multiple and identical arrays using double for loops
This can be achieved with function max. Read max

4 years ago | 0

Answered
Read multiple excel files and get the maximum value
files = dir('*.csv'); N = length(files) ; % initialize the required maximum array max2010 = zeros(N,3) ; for i = 1:length...

4 years ago | 0

Answered
Plotting a histogram (setting the color) with a fit distribution
H = histogram(A,'facecolor', [0 1 1], 'facealpha',.1,'edgecolor','k'); h = histfit(A) ; % get the data of hist-fit x = h(2)...

4 years ago | 0

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in temp = G(i,j)./(1+(i-j).^2);
What is y and z? Are they arrays or some numbers? If numbers, they shoul dbe positive, integers. Because MATLAB takes positive...

4 years ago | 0

Answered
reading a n row excel file and making a matrix
REad about readtable

4 years ago | 0

| accepted

Answered
How to apply a For loop for climatology time series analysis?
Read about retime. If not, also you can calculate the mean you want using mean.

4 years ago | 0

Answered
NaN at (5,0) in graph. How to change it? Electric field
You can fill the NaN's using fillmissing Read about this function. x = -24:18; y = (-20:2:18).'; E0 = 8.85e-12; k = 1/(4*pi...

4 years ago | 0

Answered
2-D colormap (loading .txt files)
thepath = 'kx values\*.txt' ; files = dir(thepath) ; N = length(files) ; data = cell(N,1) ; for i = 1:N file = fullf...

4 years ago | 0

Answered
Using vertcat for cell array of differing length
% Make dummy data for demo A = cell(3,2) ; for i = 1:3 for j = 1:2 N = randperm(10,1) ; A{i,j} = ran...

4 years ago | 1

Answered
Plotting the content of huge matrix.
You need not to use scatter in a loop. You can do all this at one go using scatter or you can use pcolor as shown below. x = li...

4 years ago | 0

| accepted

Answered
How to arrange this code to run
d0 = [0,0]; v0 = [2,3]; a0 = [0,0]; dt = 1e-3; n = 9001; Mass = @(d,v,a) mass(d,v,a); Damping = @(d,v,a) damping(d,v,...

4 years ago | 0

| accepted

Answered
How do I add the numbers on top of the bar graph?
A = rand(3,1) ; h = bar(A) ; text(h.XData,h.YData+0.05,num2str(A)) ;

4 years ago | 0

Answered
Forward Euler method error
The loop should be taken as: for i = 1:round(N) In your present case, it is a fraction and you are getting non integers as the...

4 years ago | 0

Answered
Obtain coordinate of a vector or multivalued function
It should be v(i) not v[i]. Read about MATLAB indexing. f=@(a,b,c,d) [a.^2-b+c+d,a-b.^2+c+d.^3,a.*b.*c.*d,a-b-c-d]; % anonymou...

4 years ago | 0

Answered
Filter an image to obtain certain pixels and retrieve their original [row,col]?
idx = find(Img>0) ; [row,col] = ind2sub(size(Img),idx) ;

4 years ago | 1

Answered
How can I represent this equation on MATLAB
Extend the example to your case. n = 100 ; t = linspace(0,4,n) ; x = 2*sin(3*pi*t) ; plot(t,x)

4 years ago | 0

| accepted

Answered
Plotting meteorological data on Geographic maps
You can download the shape files here: https://gadm.org/download_country.html To read shape files, use shaperead. You can pl...

4 years ago | 0

Answered
Count number of particles within a given radius
REad about knnsearch, rangesearch and inpolygon.

4 years ago | 0

| accepted

Answered
Delete rows with zero after importing several files
If you want to remove rows which have zeros in specific columns do: c = 2; % column to check for zero idx = Ratio(:,c)==0 ; ...

4 years ago | 0

Answered
Error saying matrices are not the same size
I think the loop should be something like this: for i = 2:length(t)-1; w(i,:) = w(i-1,:)+h*f(t(i),w(i-1,:)) ; end In yo...

4 years ago | 0

| accepted

Answered
How to create bar graph with formula and have nan in the import excel?
Read about fillmissing. You can fill the gaps/ NaN's using that function.

4 years ago | 0

Answered
FFT of Acceleration data stored in excel file
To load the data use readtable To get fft read about fft.

4 years ago | 0

Answered
Find the position matrix of boundary points in an image
You can do it manually using getpts, ginput. Read about these functions. If you want to do it automatically, you can get the whi...

4 years ago | 0

Answered
How do I find the values at a specific Y value on a 3-D surf plot?
Read about slice. Also you can find the index of your required points and extract the required values.

4 years ago | 0

Answered
How to choose surface point in 3D plot
REad about delaunaytraingulation, once mesh is formed you can use patch or trisurf. If you could do fine, else attach your data....

4 years ago | 0

Answered
When do you use periods with operators?
If you are doing scalar operations, then periods are not needed. a = rand ; b = rand ; a*b a^b If you are doing array ope...

4 years ago | 0

| accepted

Answered
Plotting 4D surface plot (x,y,z and one is colour bar)
A = [-0.5788245 0.30687669 0.22984767 0.22355179 -0.1582685 0.29329778 0.24892007 0.22159881 -0.6557496 0.308436399 0.22769311...

4 years ago | 0

Answered
Calculate distance from geographics points
USe Haversine's formula: Let (lon1,lat1) and (lon2,lat2) be your coordinates in degrees. % Haversine formula dlon = lon2 - l...

4 years ago | 1

Answered
how to multiply a curve (in a plot) by -1, if you do not have the original data? (I only have the plotted data.)
https://in.mathworks.com/matlabcentral/answers/383567-how-to-extract-x-y-data-values-from-matlab-figure https://in.mathworks.c...

4 years ago | 0

Answered
intensity plot x-y plane
Read about pcolor, surf. Your code is a mess, it needs lot of changes. You shoul dinitialize the arrays which are getting fi...

4 years ago | 0

Load more