Answered
add constant value to row
A=readmatrix('yourFile.xlsx'); A(:,end+1)=600;

3 years ago | 0

Answered
Minimize a variable in a no-linear system
If you use the Problem Based optimization tools, you can pretty much type in the problem as you have for us above, and the solve...

3 years ago | 0

| accepted

Answered
run takes too long!
i have this code that it runs and answers are correct but it takes so long...why?is there any solution? It is unnecessary to us...

3 years ago | 0

| accepted

Answered
How to rotate a 2D array (2D image) in 3D space around the x-axis?
A=rand(5) theta=90; R=eye(3); R(2:3,2:3) = [ cosd(theta) -sind(theta); ... sind(theta) cosd(theta)]; A=...

3 years ago | 0

Answered
How can I remove some specific rows in which zero an nan values exist?
load stations2 cutrows=stations2(:,2)==0|isnan(stations2(:,2)); stations2 stations2(cutrows,:)=[]

3 years ago | 0

| accepted

Answered
Question about matrix manipulation
Using this FEX download, it's fairly easy: https://www.mathworks.com/matlabcentral/fileexchange/115340-block-transposition-perm...

3 years ago | 0

| accepted

Answered
introducing a comparison related to variables in linear programming
The constraints you describe are non-convex, so there is no way to formulate them in a linear way. However, you can modify your ...

3 years ago | 0

| accepted

Answered
Neat enclosed area for a group of points on a plane
Your attached Data.mat looks like it contains different Data from your posted figure illustrations. load Data shp=alphaShape...

3 years ago | 1

| accepted

Answered
Minimize the Sum of Square error using optimization
I think you can do the whole optimization analytically. In particular, rewrite E as, where A and B...

3 years ago | 0

Answered
How to compare the the values of a 3-d dimensional array
n=find( 6000-100*t_span < E_lower,1); [~,kmin]=min(p(:,n,:),[],3);

3 years ago | 1

| accepted

Answered
How to Interpolate coordiantes and values of a surface plot
You can build a scatteredInterpolant object. Then you can interpolate anywhere you wish. load('mesh_coordinates.mat'); centr...

3 years ago | 0

Answered
Error in using lsqcurvefit with constrained parameters.
I think you can set the upper bounds equal to the lower bounds to fix the parameters as the OP in the previous post originally w...

3 years ago | 0

Answered
To find exponent in power law equation of the form y = ax^m + b
fminspleas downloadable from https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas is especially appropriate...

3 years ago | 0

| accepted

Answered
To find exponent in power law equation of the form y = ax^m + b
If you have the Curve Fitting Toolbox, a = 0.55; m = 1.3; b = -0.78; % dummy data x = (1:25)'; y = a*x.^m + b + randn(si...

3 years ago | 0

Answered
Check Gradient (Jacobian) of objective function -- what is the meaning of absolute difference (1e-6) if component of gradient is less than 1 ?
If I know my values are so small (around 1e-7) per nature, a difference between 1e-7 and 2e-7 is significant. Not necessarily. ...

3 years ago | 0

| accepted

Answered
Removing semicolons from data
str = fileread('12h.json'); % dedicated for reading files as text  data = jsondecode(str); % Using the jsondecode function to...

3 years ago | 0

| accepted

Answered
Find distance from centroids to a specific point and remove objects that are having greater distance than the threshold
stat = regionprops(BW,'centroid','PixelIdxList'); ... CentroidDistances=pdist2(centroids,ECR); stat=stat(CentroidDistan...

3 years ago | 0

Answered
Draw circle in a rectangular
N=500; [x,y]=ndgrid(linspace(-10,10,N)); cmsk=x.^2+y.^2>=1; emsk=padarray(zeros(N-6),[3,3],1); [R,G,B]=deal(~cmsk&~em...

3 years ago | 0

Answered
Draw circle in a rectangular
s=([0 0 ; 0 1; 1 1; 1 0]-1/2)*20; t=linspace(0,360,1000)'; c=[cosd(t), sind(t)]; patch('XData',s(:,1),'YData',s(:,2),...

3 years ago | 0

| accepted

Answered
I need an optimvar to be zero when another optimvar is zero
Impose the constraint w<=x.

3 years ago | 0

Answered
Draw circle in a rectangular
c=nsidedpoly(1000); s=subtract(nsidedpoly(4,'Side',20),c); h=plot([c,s]); axis equal h(1).FaceColor='red'; h(1).FaceAlpha=1;...

3 years ago | 0

Answered
Fast computation of entries of large matrix
x1=rand(2500,5); % some matrix with high number of rows and small number of columns > 1 x2=rand(2400,5); % another matrix w...

3 years ago | 1

| accepted

Answered
element-wise operator to scale rows of matrix with entries of a vector
Also, applies the element-wise operator .* to its left argument (here, A) or to its right argument (here, d)? .* has two operan...

3 years ago | 0

| accepted

Answered
how to pass keyword arguments to a function via a struct
You'll have to go old school and use inputParser. y = struct('a',8,'b', 9); x=examplefn(y) x=examplefn('a',8,'b',9) functi...

3 years ago | 0

Answered
Faster interpolation of 2-D spatial data at different time steps without looping through the time steps?
Using func2mat from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/44669-convert-linear-functions-to-m...

3 years ago | 0

| accepted

Answered
How to replace all row vectors except 1st according to the difference?
two = (two(1,:)-u).*logspace(0,-5,100)' +u;

3 years ago | 1

| accepted

Answered
Find minimum of a generic polynomial
roots(polyder(p)) will find the roots of the derivative of p. You can then evaluate the polynomial at all the roots to see where...

3 years ago | 1

Answered
Translate 3D coordinates on a known surface
This FEX download seems to do what you want. I haven't used it myself, though. https://www.mathworks.com/matlabcentral/fileexch...

3 years ago | 0

| accepted

Answered
How can I calculate unknown roots from a matrix
A = [ 12 22 33 44 ; 49 56 68 79 ; 10 11 12 13 ; 46 58 64 79 ]; B = [15 16 17 18 ; 44 58 67 71 ; ...

3 years ago | 1

| accepted

Load more