Answered
Finding optimal parameters of a conjoined distribution of N variables over given data with fminsearch
To answer your question, you wouldn't define J using a loop at all. Your f(x) are vectorized over the measured data vector y, so...

3 years ago | 0

| accepted

Answered
How can assign numbers between two integer numbers instead of ones in a [0 1] matrix?
Sure. randi([lower,upper], 6,5)

3 years ago | 0

Answered
Plotting grouped 3D bars from 3D matrix
Perhaps as follows: z=rand(5,4,5);%Fake data numDelta=size(z,3); clear xtk for i=1:numDelta h=bar3(z(:,:,i...

3 years ago | 1

| accepted

Answered
How to find files containing two words with an extension.
Remove the extra asterisk: filename = dir('*pa750*mask*.mat')

3 years ago | 1

Answered
Is it possible to show two .fig files in the same figure?
I am able to display two .fig files in the same figure as in the code below (like hold on function). When you use hold on/off, ...

3 years ago | 0

Answered
rotate polar angle by an arbitrary angle
THETA0=THETA0-beta;

3 years ago | 0

| accepted

Answered
Why I'm getting a complex degree value while using "acos"?
Because abs(dir_mag2/dir_mag1) is greater than 1. abs(dir_mag2/dir_mag1)

3 years ago | 0

| accepted

Answered
fminsearch gives weird zick zack solution
It seems unlikely to me that x0=[1,1,1] would be an accurate initial guess. Surely, you chose that arbitrarily. Since you only h...

3 years ago | 0

Answered
gernerating standard normal variable in matlab
at what value of n will i get the value close to identity? Well, with your current code, z will always contain only ones, so th...

3 years ago | 0

| accepted

Answered
Why am I getting Empty sym: 0-by-1, everything in SYMS is just equal to itself, the eqn1 is working properly comparing the correct things, but not working properly, pleasehelp
Look at your first equation. You have Vb set to 3 different literal constants. How can those equalities be simultaneously satisf...

3 years ago | 0

Answered
How best to overlay bar graphs from histcounts of different data?
A solution with interlacing: [v1, e1] = histcounts([2 5 3.4 5.3 5 4 8 7],linspace(3,6,4)); [v2, e2] = histcounts([3.4 5.5 6.4 ...

3 years ago | 1

| accepted

Answered
How best to overlay bar graphs from histcounts of different data?
Maybe make the bars semi-transparent? You can also play with the edge thicknesses to emphasize the area of inclusivity of the ba...

3 years ago | 1

Answered
Dot notation and curly braces with TABLE
In Matlab, there are circumstances in which indexed assignments will convert the type of the right hand side in order to be cons...

3 years ago | 0

Answered
Unwanted black background on a figure
I have no idea why it's like this. That seems to be the default color scheme, judging from this doc page, https://www.mathwork...

3 years ago | 1

| accepted

Answered
if loop to find values in a variable
One possibility t = [4 5 7 8 10 11 12 15 17 20 22 24 26 27 28]; Q = [1 3 4 1 5 8 4 2 6 1 4 2 8 3 5]; p = 10; np = 3; c ...

3 years ago | 0

Answered
Is there a way to speed up the computation of a piecewise defined function?
Use logical indexing, %Option 1.1 x=-10:10; y=x; y(x<=-5)=-2; p=abs(x)<5; y(p)=sin(x(p)); struct.x=x; struct.y=y;...

3 years ago | 0

Answered
After migrating from MATLAB 2020b to 2023a my cpp application can't load mcc DLL
It sounds like your code is linking to the 2020b Matlab Runtime, instead of the newer one. If you know how to adjust that, you p...

3 years ago | 0

Answered
Find values of two variables corresponding to query points of two matrices.
You should use fsolve or fminsearch to solve the original equations. Both of these are iterative solvers requiring an initial gu...

3 years ago | 0

Answered
fminbnd error in calculating of solar cell efficiency with detailed balance
Perhaps you meant to have, F = @(V) norm( V.*-q.*(Nabs - Fluxfunction(Eg, Egmax, Tc,V)) ); Otherwise, it is not clear how t...

3 years ago | 0

| accepted

Answered
Using different line style to generate plot
N = 10:20:500; err = rand(6,numel(N)); %fake h = loglog(N,err'); [h.LineStyle]=deal('-','--','-.',':','--','--'); [h(end-1...

3 years ago | 1

| accepted

Answered
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
Possibly mproc or one of its callers has path-altering commands that temporarily remove cmap from the path. To be certain, we wo...

3 years ago | 0

Answered
Error using pcread and pcshow
I wouldn't know how to do all the image processing and segmentation work that I could do in a simpler and more direct way with t...

3 years ago | 0

Answered
How do I fix "Index exceeds the number of array elements"?
Well, period=50 so x1(period+1:2*period) is the same as x1(51:100). Since x1 has length 50, indexing it from 51:100 won't work. ...

3 years ago | 0

Answered
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
So this specific line of code is just refusing to work for seemingly no reason. Maybe there is some invisible character in tha...

3 years ago | 0

Answered
Can I use parfeval in App Designer to plot to a UIAxes while the code keeps running?
A mechanism equivalent to .mat file saving is how data is transferred to parpool workers. The plotFcn that you give to parfeval ...

3 years ago | 1

| accepted

Answered
have an array of inputs instead of constants
Just concatenate all the constants into a vector and bring that into Simulink, constants=[m,alp_ang,...,MaxBrk]

3 years ago | 1

Answered
How can I find fitness values of optimized results in gamultiobj tool?
The fval output from gamultiobj should give you those values: [x,fval] = gamultiobj(___)

3 years ago | 0

Answered
How do I extract a structure array from a single dynamic structure without using for loops?
There is no way to avoid for-loop speed when dealing with structs and cells. Below is a way to abbreviate the syntax, but both n...

3 years ago | 0

| accepted

Answered
Plot 2d images into Cylindrical 3D image with degree increment
There are several applicable File Exchange contributions. Here are 2 of them, https://www.mathworks.com/matlabcentral/fileexcha...

3 years ago | 1

Answered
concatenate array of structures with same field names
So why is it that Matlab cannot use fread to read a structured file? Not sure how fread is implemented (does it use C++ fread or...

3 years ago | 0

| accepted

Load more