Answered
Assigning X-Y Coordinates to 2-D Matrix
What I think you are trying to do is, [x,y]=meshgrid([0,100,200],[200 100 0]) plot(x(:),y(:),'*'); axis padded

4 years ago | 0

Answered
How to use cat properly
The cat command is not causing the change that you are seeing in the array shape. What's causing it is the fact that you are ind...

4 years ago | 0

| accepted

Answered
take a sum in a matrix and print it on a different row
proctime=[2 1 3 6]; n=numel(proctime); endtime=cumsum(proctime); starttime=[0,endtime(1:n-1)]; table(proctime',starttime',...

4 years ago | 0

| accepted

Answered
How do I extract the vertices to see their position?
polyin{k}.Vertices

4 years ago | 0

Answered
find radius of xyz data
I would like to use inclircle [sic.] function to find the diameter Are you trying to enclose the points in a sphere or a cylind...

4 years ago | 0

Answered
Compute the face normal of the triangle and its normalized equivalent.
A face normal is the vector perpendicular to the plane of the triangle. I have three sides of triangle in vector form [x,y,z] ...

4 years ago | 3

| accepted

Answered
How to count elements in array until criteria is met and output number of elements?
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 0

Answered
Find rows with common values using intersect
Perahps as follows. A=readmatrix('example.txt'); [m,n]=size(A); discard=1:m+1:m^2; p=perms(1:n); np=size(p,1); IJ=cel...

4 years ago | 0

| accepted

Answered
Brute Force for finding optimal value?
fmincon is not brute force, but it would be overkill for a single-variable problem. You should use fminbnd instead. How to do i...

4 years ago | 1

| accepted

Answered
Optimization of weighted sum
You did not include Dconst or the corresponding z, so I eyeballed both from your attached .jpg image. load Dose.mat C=[D1,D2,D...

4 years ago | 0

| accepted

Answered
Given three points in space, how do I get the changed angle of the plane over time?
Given 3 points in the plane P1,P2,P3. u=normalize( P1(:)-P3(:) ,'n'); v=normalize( P2(:)-P3(:) ,'n'); w=cross(u,v); u=cros...

4 years ago | 1

| accepted

Answered
Determining relative angular orientation of vectors
Perhaps as follows? vector = [1 ; 0]; P1 = [-sqrt(0.0075); 0.05]; P2 = [-sqrt(0.0075); -0.05]; new_vec1 = refract(vector,P...

4 years ago | 0

| accepted

Answered
How to do distance formula
A=pdist2(X,X); distances = A( sub2ind(size(A) ,e(:,1),e(:,2) ) )

4 years ago | 0

Answered
How can I straighten a line in an image?
It sounds like what you would want to do is fit the squiggle with two lines that are constrained to be parallel. That can be do...

4 years ago | 0

| accepted

Answered
fsolve no solution found system of two equations
Your function is not differentiable for x(2)<0, so we must impose a lower bound to make it positive. But when we do that as belo...

4 years ago | 0

Answered
Cut a picture as needed
Download mat2tiles and then, Image=rand(900); A=mat2tiles(Image,[300,300])

4 years ago | 2

| accepted

Answered
Condensing code cannnot figure out easier function to use
thresh=30; G=repelem(1:31,300)'; count = sum( accumarray(G(1:numel(differences)),differences(:)) > thresh);

4 years ago | 0

Answered
How can I store and sum matrix using loop for?
A = sparse matrix (20000x20000) L = speye(size(A)); for ii = 1:200 C{ii} = A^ii; L = L + C{ii}; end

4 years ago | 1

| accepted

Answered
How can I interpolate a vector to increase the length up to a desired quantity?
You can do it with interp1() or griddedInterpolant().

4 years ago | 0

Answered
how to find intersection point in arrays with for cycle?
isel2 is an empty set Sure, why not? Nothing in your code reveals why lonP= 13.5, latP= 41.9 are expected to coincide exactly w...

4 years ago | 0

| accepted

Answered
Can I combine multiple objective functions that share same optimization parameters for lsqnonlin?
No, lsqnonlin is not a multi-objective solver. It minimizes the single objective function sum(rssOutput.^2). If you want it to m...

4 years ago | 0

| accepted

Answered
How to find the index of first and last nonzero elements in each column?
A=[0 0 0 0 0 0 0 0 1 0 4 0 2 0 5 0 3 1 6 ...

4 years ago | 1

Answered
suggest me on what should be done for step 5 and 7.
For step 5, imgaussfilt(Image1,fsize,'FilterSize',6*fsize+1);

4 years ago | 0

Answered
the math of movmean
If if the data looks like, DATA=[x1,x2,...xn , a,b,c,d,e, y1,y2,....,ym] then movemean(DATA,5) will replace c with mean...

4 years ago | 0

Answered
Roots of the determinant of a 12x12 matrix with single nonlinear variable
I would plot the determinant as a function of w. Then, based on inspection of the plot, I would use fzero to find roots in appro...

4 years ago | 0

Answered
How to have Matlab create a random matrix that is fullrow rank?
rand() or randn() should give you a full row rank (in probability one) matrix provided there are fewer rows than columns. rank(...

4 years ago | 0

| accepted

Answered
How to split data set into multiple bins and perform condition statement on bins
Use the discretize() command. https://www.mathworks.com/help/matlab/ref/double.discretize.html to assign bin labels to each o...

4 years ago | 0

Answered
Generate Look up table from curve fit toolbox
You can export the resulting fit to the Matlab base workspace as described here, https://www.mathworks.com/help/curvefit/genera...

4 years ago | 0

Load more