Question


How is DefaultFigurePosition set for apps?
I have set my DefaultFigurePosition to a particular setting. Ordinary plot figure windows obey the setting, opening in the desir...

5 years ago | 1 answer | 0

1

answer

Answered
How can I get two theta degree from one cos(theta) rad.
theta=acosd(0.8037) Theta=360-theta

5 years ago | 0

Answered
vector discretization to sum of values in each bin
data = [1 1 2 3 6 5 8 10 4 4]; edges = 2:2:10; Y = discretize(data,edges); valid=isfinite(Y); result=accumarray(findgrou...

5 years ago | 0

| accepted

Answered
How to use stairs (or another function) to create stairs in a 3d space
Here's another method using repelem. IMO, it is a bit more transparent way to achieve a desired staircase geometry. You can use ...

5 years ago | 0

| accepted

Answered
Newton's method iterations
https://www.mathworks.com/matlabcentral/answers/1465089-newton-s-method-for-root-approximation-using-multiple-initial-values?s_t...

5 years ago | 0

Answered
How to create a matrix using two arrays (x & y) and a formula that uses x & y
Use implict expansion. x = [4.0:-.05:3.7] ; y = [9;15;21;27;33;39;45]; z = 1.3473*152./(152+y)+(5-x).*y./(152+y)

5 years ago | 0

| accepted

Answered
Using matlab to plot 4 separate sine wave equations on the same curve.
t=linspace(0,360,1000); v=4*sind(t); region1=30<=t & t<=150; region2=t>180; v(region1)=1+2*sind(t(region1)); v(region2)=0; ...

5 years ago | 0

| accepted

Answered
How to use stairs (or another function) to create stairs in a 3d space
Something like this, perhaps? x=linspace(1,3); y=x.'; z=round(3*x +2*y); surf(x,y,z,'EdgeColor','none') view(30,20);

5 years ago | 1

Answered
Find middle point between extrema and zero crosses
Is this what you want? x=1:5 %Points movmean(x,2,'End','discard') %points in between them

5 years ago | 0

Answered
Fastest way to differentiate only the sides of large matricies
This seems to be about as fast, at least on the GTX 1080 Ti. T=reshape(B([1:S+1,N-S:N],:) ,S+1,2*N^2 ); A3 = reshape( diff(T...

5 years ago | 1

| accepted

Answered
How to create a row matrix from taking a random element from each column of a matrix of floating numbers?
r=randi(2047,1,7); result=yourMatrix( sub2ind([2047,7], r, 1:7) )

5 years ago | 0

| accepted

Answered
How to arrange the constraints shape to A matrix and b constants automatically ( Ax <= b)??
Using the problem-based solvers, you do not have to build things in matrix form, e.g., x=optimvar('x',4,'LowerBound',0,'UpperBo...

5 years ago | 0

| accepted

Answered
End Points on movmean don't look right
If I read this correctly-for element 1 of the dataset, only element 1 "fills the window". No, the length 3 window is centered o...

5 years ago | 0

| accepted

Answered
"opengl software" is not supported in command line?
An NVIDIA driver update seems to have cured it.

5 years ago | 0

Answered
How to get an array of all field elements of a 1xN structure with many fields
I would recommend the attached file S(1).a = 1; S(2).a = 2 ; S(1).b = 3 ; S(2).b = 4; T=scalarize_struct(S)

5 years ago | 0

| accepted

Answered
Newton's Method for root approximation using multiple initial values
Is there a way to just change the x0 value somehow and put everything in a for loop so that I only have to actually have one blo...

5 years ago | 0

Answered
multiple boundary conditions for lsqlin
Well, the conditions you've mentioned together simply imply lb=0.95 and ub=1.00, so it should be pretty easy, x=optimvar('x',21...

5 years ago | 0

Answered
Integer Linear Programming Problem
min_power.Objective = x' * wi_T + y' * pump_power_T;

5 years ago | 0

| accepted

Answered
How to obtain the 3 × 3 symmetric covariance matrix of a 3x1 matrix?
cov(A) considers the rows of A to be different observations and the columns of A to be different variables. So, if A is 3x1, the...

5 years ago | 0

Answered
Unstable solution for constrained nonlinear optimization problem!
Well, if you make the change of variables y=(1-x1)^(1/x2) then the objective becomes a simple 1D quadratic objective = @(x) p0*...

5 years ago | 1

| accepted

Answered
intersection the red edges of the mask to a grayscale image
Is this what you want? I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/755699/001.png'); [B,L] = bw...

5 years ago | 0

| accepted

Answered
extract roll pitch yaw rotation angles from 3D transform
The quadricFit class in this File Exchange package https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-t...

5 years ago | 0

Answered
Can I use different models to do a 2D fit?
Yes, but you don't need the Curve Fitting Toolbox just tod surface interpolation. With interp2 (if you have gridded data) you ca...

5 years ago | 0

| accepted

Answered
convert 3D plane to 2D plane
One possible projection is, [x2;y2]=null([a,b,c]).'*[x3;y3;z3] However, the mapping you are looking for is non-unique. There a...

5 years ago | 0

| accepted

Answered
Can someone explain what's wrong with my formula?
Be careful of missing dots... V = (-I./omega.*C).*cos(omega.*t)

5 years ago | 0

| accepted

Question


Fill background pixels with the value of the nearest foreground pixel
I have a grayscale image I and a logical mask of its foreground FG. I would like to do the operation roughly described as, I(~F...

5 years ago | 1 answer | 2

1

answer

Answered
Applying homogenous transformation matrix to image to demonstrate translation, rotation and scaling. I tried it by using affine3d but getting some errors.
Since the image is 2D, you need to use affine2D() and your T matrix must be 3x3. file = 'cameraman.tif'; A = imread(file); ...

5 years ago | 0

| accepted

Answered
find minimal difference for vector (Optimalisation algorithm)
See lsqcurvefit. https://www.mathworks.com/help/optim/ug/lsqcurvefit.html

5 years ago | 0

Answered
How I sum to matrix wich one is the mean of the value and the other the standard deviation?
I this what you mean? [m,n]=size(meanbasket); value=meanbasket+randn([m,n]).*devstdbasket;

5 years ago | 0

| accepted

Answered
Is there a two-dimensional sinc interpolation software?
Since interpolation is commonly approximated by cubic spline interpolation, which you have an option for in interp2. Vq = inter...

5 years ago | 0

Load more