Answered
Find the value of x for a specific value of y
fun=@(z)interp1(x,y,z)-500; x1 = fzero(fun,[0,0.1]); x2 = fzero(fun,[0.1,1]);

5 years ago | 1

| accepted

Answered
Plot one column matrix in range
y=matrix; x=linspace(0,10,numel(y)); plot(x,y)

5 years ago | 0

Answered
how to find all points of intersection between two functions on same graph?
If you have analytical expressions for the functions and if you have the Symbolic Math Toolbox, then you can use solve(), https...

5 years ago | 0

Answered
restricting get method to not process all the values
There doesn't seem to be a good reason for this to be a get method. Just use a regular method. function out = FWHM(obj,RowIND,C...

5 years ago | 0

| accepted

Answered
using struct to plot multiple set of data on multiple figures [figure properties]
My question is why doesn't myFig(1).fig or myFig(1) works ? Neither of these are commands. Is there a way to include title usi...

5 years ago | 1

| accepted

Answered
Solving non-linear equation in vector form
syms u t fun=matlabFunction( solve(t^2/64==u,t) ); u2=[1,4,9]; t1=fun(u2)

5 years ago | 1

Answered
Solving non-linear equation in vector form
If you have the Optimization Toolbox, u2=[1,4,9]; opts=optimoptions('fsolve','SpecifyObjectiveGradient',true,'OptimalityTole...

5 years ago | 0

| accepted

Answered
Solving non-linear equation in vector form
u2 = rand(1,1000); t1=8*sqrt(u2);

5 years ago | 0

Answered
Organize matrix in a random way
N=size(H,1); H=H(randperm(N),:);

5 years ago | 0

| accepted

Answered
Get coordinates from struct created with bwconncomp
Use regionprops instead, stats=regionprops(BW,'PixelList')

5 years ago | 0

| accepted

Answered
Is it possible to do multi index command in one line?
This is a generally applicable one line implementation, but probably not what you'd hoped for. A = [1 2; 3 4]; myCol = subsr...

5 years ago | 0

Answered
Is it possible to do multi index command in one line?
An approximation of this can be enabled through some incredibly convoluted OOP methods https://www.mathworks.com/matlabcentral/...

5 years ago | 0

Answered
Fit Normalised Gaussian to data
You can use, https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn Example: %% Synthetic data fn=@(x,a,mu,sig...

5 years ago | 0

Answered
Is it possible to do multi index command in one line?
Not in general, but in the case of your example there is a shorter syntax, myCol=size(A,2)

5 years ago | 0

| accepted

Answered
Unable to append zeros to the vectors and matrices from within the member functions
Either make your class a handle class classdef Organ_Python<handle or return a modified object from the growth() method func...

5 years ago | 0

| accepted

Answered
How do I switch specific elements in an index?
The best practice is to index the matrix and assign to those indices, as in the following example, x = zeros(5,5); indices=[...

5 years ago | 0

| accepted

Answered
Diagonal of non-square matrix
n=8; R=[2,3,4,zeros(1,n+2-3)]; C=[2,zeros(1,n-1)]; T=toeplitz(C,R)

5 years ago | 0

| accepted

Answered
How to extract rib cage for finding region of interest ?
I cannot detect rib cage with bwarefilt() to extract because it checks just 2d A 3D (and higher) version of bwareafilt is avai...

5 years ago | 1

| accepted

Answered
Optimization based line fitting
p = optimproblem; c = optimvar('c',2); p.ObjectiveSense = 'minimize'; p.Objective = sum((E*c-y).^2); p.Constraints=[1,exp(-5...

5 years ago | 0

| accepted

Answered
How to reduce space between plots in subplot and how to increase the area of plot in subplot
You can also replace subplot with subaxis https://www.mathworks.com/matlabcentral/fileexchange/3696-subaxis-subplot

5 years ago | 0

Answered
Camera calibration matrix. Find camera center, vanishing points of the {W} X, Y and Z and the equation of principle plane
I think you should probably know this, but (a) null(P) (b) P(1:3,1:3) (c) P(3,:)

5 years ago | 0

| accepted

Answered
Using 'fzero' in a for loop
Do you really need to save the sequences of anything besides the M_x(i)? If not, then, for i=1:IL-1 A_Astar_x = (y(i...

5 years ago | 1

| accepted

Answered
Switching model parameters for optimization problem
I'm assuming x is unknown and u is known. Wouldn't it then just be, Ppos=(u>=0); Bu=nan(size(u)); %the vector B*u Bu(Ppo...

5 years ago | 0

Answered
Relpace array elements by another array where both array length are not equal?
A(1:size(B,1),:)=B;

5 years ago | 1

| accepted

Answered
Is it possible to vectorize this ?
A(~A)=nan; result=mean(A(:,B),1,'omitnan')

5 years ago | 1

| accepted

Answered
Matlab optimproblem , optimvar
It means those functions are not supported by the Matlab Coder. You will have to specify the optimization problem in solver-base...

5 years ago | 0

Answered
Non-zero Gaussian noise in image processing
As an example, mu=0.1;sigma=0.3; J = imnoise(imread('cameraman.tif'),'gaussian',mu,sigma^2); imshow(J)

5 years ago | 0

Answered
solve non-linear optimization problem
With fmincon, if you have Optimization Toolbox. https://www.mathworks.com/help/optim/ug/fmincon.html

5 years ago | 0

| accepted

Answered
how to preform Laplace transform?
The laplace() command only works on Symbolic Math Toolbox variables, e.g., syms y(t) y=exp(-t).*heaviside(t); Y=laplace...

5 years ago | 1

Load more