Answered
I want a Matlab Program for creating a single frame with combined plots of a surface plot of a two-dimensional standing wave field in addition to an image of projection plot
x = linspace(-1, 1, 100); y = linspace(-1, 1, 100); [X, Y] = meshgrid(x, y); frequency = 1; amplitude = 1; Z = amplitude * sin...

3 years ago | 0

| accepted

Answered
Using lsqcurvefit for parameter optimisation
Since you are just trying to verify the results of a previous paper, initialize with the solution parameters that the paper prov...

3 years ago | 0

Answered
returning a unique array and comparing it with a different array.
The whole thing can be done in one line. No need for unique, reshape, or any of the rest of it. result = ismembertol(a,y_cosno...

3 years ago | 0

| accepted

Answered
Improving performance of parallel code sections
The task is too small for parallelization to have any meaningful effect. Similarly, the relative performance numbers for the dif...

3 years ago | 0

Answered
Is it possible to have a line graph with a different marker for each point on the same line?
You can effect that as below. I don't see why you'd want it, however. x = 1:5; y = [2, 3, 1, 4, 2]; xc=num2cell(x); xc{end+...

3 years ago | 1

| accepted

Answered
Fminsearch does not work after increasing maxiter
The warning is not coming from fminsearch. It is coming from the ODE solver. As fminsearch iteratively explores different choice...

3 years ago | 0

Answered
How do I make the fit better so that there are no negative y-values for the fit?
Why use fit() if you just want to interpolate? Why not use interp1 with the 'pchip' method instead? clc; clear all; %% --Va...

3 years ago | 0

| accepted

Answered
How do I make a secondary Y axis
It is, unfortunately, a very awkward thing to do. The datatip will show y3 with an increment of 200, but there may be ways to cu...

3 years ago | 2

Answered
How to get equispaced values with a more exact result than using linspace and column functions?
I want exactly equispaced output There is no such thing as exactly anything in floating point computation. The inaccuracies you...

3 years ago | 1

Answered
MATLAB won't run script unless functions are defined in a specific order?
As long as all your functions are placed at the bottom of the script, it shouldn't matter what order they are in.

3 years ago | 0

Answered
Sort function indices in regards to the original data?
[val,is] = sort([86.9565 69.5652 65.2174 52.1739 43.4783 65.2174 91.3043 60.8696],'descend'); idx=1:numel(val);...

3 years ago | 2

Answered
How to split array into sub arrays?
a = [1 3 5 8 11 12 15 17 18 19 20 21 24 29 31 32 33 34 35 36 38 39]; G=findgroups(discretize(a,[0:10:max(a)+10],'Include','ri...

3 years ago | 0

Answered
Cubic interpolation coefficients and basis matrix
Using this FEX downloadable, https://www.mathworks.com/matlabcentral/fileexchange/44669-convert-linear-functions-to-matrix-form...

3 years ago | 0

| accepted

Answered
Getting points back from convexhull/trisurf, or 'how to find the closest point on a 3d surface to a given point.
This might be what you're looking for, https://www.mathworks.com/matlabcentral/fileexchange/52882-point2trimesh-distance-betwee...

3 years ago | 0

| accepted

Answered
How to get a smooth boundary between clusters?
Once you've extracted the boundary points, you could use sgolayfilt to smooth them.

3 years ago | 1

Answered
Computation of the distance of the points from the interpolation curve?
dist = pdist([flowrate y], 'euclidean','Smallest',1);

3 years ago | 1

Answered
Which algorithm does SVD function take?
The SVD algorithm is not disclosed by MathWorks, but even if you could be sure the same algorithms were used by both Matlab and ...

3 years ago | 2

| accepted

Answered
shade the area between curves
% Define the data as column vectors x1 = [0.001 0.055178 0.06313 0.071457 0.072486 0.089794 0.099338 0.099518 0.107103 0.118855...

3 years ago | 0

Question


How to detect whether a figure is created by uifigure()
I have the following in my startup.m file, set(groot,'defaultFigureCreateFcn',@(fig, ~)addToolbarExplorationButtons(fig)); ...

3 years ago | 2 answers | 1

2

answers

Answered
Can I upload the results of my work with a home license to GitHub?
I don't think any of the licenses restrict your ability to share your code, with the obvious caveat that if you try to sell it ...

3 years ago | 0

Answered
For matrix A you cannot do: A.^2(:)
You cannot apply ()-indexing to mathematical expressions, function calls, or literal constants, only to variables. So, in your c...

3 years ago | 1

| accepted

Answered
Piecewise Function (Toolbox Doesn't Work)
Why bother with symbolic math? Why not just plot as below? n=linspace(-2,5); f = @(n) (3*exp(-n).*sin(pi*n)).*(n>=0); plot(...

3 years ago | 0

| accepted

Answered
How to add colorbar using image data
I would guess maybe, colormap parula However, we really need to see the corresponding grayscale image to make an informed choi...

3 years ago | 0

Answered
How to remove surface segments produced with trisurf (based on delaunyTriangulation)?
You could use faceNormal to find which facet normals are sufficiently aligned with the z axes as to consider them part of the to...

3 years ago | 0

| accepted

Answered
What is the Distinction Between Answers and Discussions?
Answers is intended for seeking solutions to difficulties encountered by the OP in using Matlab. Discussions is not for solutio...

3 years ago | 2

Answered
How can I maximize a tiled layout in a live script?
TL=tiledlayout(3,1); Fig2=TL.Parent;

3 years ago | 0

| accepted

Answered
Hi, I am plotting surfaces and I want to connect them with interpolation, but I don't know how.
% Define the data as column vectors x1 = [0.001 0.055178 0.06313 0.071457 0.072486 0.089794 0.099338 0.099518 0.107103 0.1188...

3 years ago | 0

| accepted

Answered
Why does a griddedInterpolant use twice as much memory as the array of values that it's interpolating between?
I suspect that griddedInterpolant does not really consume twice what V consumes. I think it is just a quirk of whos(). Remember ...

3 years ago | 0

| accepted

Question


Assign a customized image to an icon on the Quick Access Toolbar
I have created two Quick Access Toolbar buttons that let me toggle between two desired Matlab Desktop layouts, one which arrange...

3 years ago | 1 answer | 1

1

answer

Answered
When using the "fit" command with a startpoint vector, matlab will sometimes not fit the data and will instead just assume my startpoint is the best fit
Numerical problems are created when your T and X data are very different orders of magnitude. Change the units of your X to some...

3 years ago | 1

| accepted

Load more