Answered
Calculation of summation with filtering positive and negative values
% Set seed for reproducibility rng default % Some pretend data u = randn(4,4,3); % Identify positive u uIsPos = u >= 0;...

3 years ago | 0

Answered
My graph returns blank, how do I fix that and get my curves?
It's not clear to me what you intended to calculate, but you end up taking the exponential of something that is already 10^39, w...

3 years ago | 0

Answered
accuracy calculation in machine learning
I'm not sure where your misunderstanding is, but let's take a look at the second formula you wrote for accuracy_tmp: accuracy_t...

3 years ago | 0

Answered
Help requested for generating an example for this kind of 3D plot
Take a look at the MATLAB Plot Gallery for something similar. You can copy code from there. You probably want either mesh or su...

3 years ago | 0

Answered
Graph doesn't update until I hit a breakpoint or pause
You can use the drawnow function to force figure updates and pending callbacks.

3 years ago | 0

| accepted

Answered
how can i find the slope of a regression line
% Set seed, for reproduciblity rng default % Make up some data x = (1:10)'; y = 2 + 3*x + randn(10,1); % Fit the model ...

3 years ago | 0

| accepted

Answered
None of my plots are showing up
The first section of your code produces a plot, as you can see here. fs = 32; t = 0:1/fs:1; g1 = [1 zeros(1,length(t)-1)]; s...

3 years ago | 1

Answered
I have one column data 57600 points, how can i convert it to 240 by 240 matrix!
% Input V = rand(57600,1); % Reshape it M = reshape(V,240,240); You may need to transpose M for your purposes.

3 years ago | 0

Answered
how to use ones to make an array with size determined from a large number listed in scientific notation?
If samples_in_trials is truly an exact integer, then it will not display like that: samples_in_trial=94500 You have not told u...

3 years ago | 1

Answered
Need to remake this optimize function to be efficient takes way to long currently
The only thing that is taking a long time is that your code is displaying almost every output to the command window. Put semico...

3 years ago | 1

Answered
Is it possible to insert multidimensional arrays within table entries?
I don't think an element of table can be a mutli-dimensional array, but it can be a cell that holds a multidimensional array: %...

3 years ago | 0

| accepted

Answered
Comparing three files to see what functions were used
I'm not sure it will work for your specific case, but the Dependency Analyzer sounds like it might be helpful.

3 years ago | 0

| accepted

Answered
jsonencode not right format
Is it possible for you to store that number as an integer instead, for example apiData.run_id = int64(1720787); ? ...

3 years ago | 0

| accepted

Answered
What does this function do?
It removes the first element of pz: pz = [2 3 5 7] pz = pz(2:end) For a matrix, it will use linear indexing, and the output w...

3 years ago | 0

| accepted

Answered
the command linprog is incosistent when i use 'X0'
I'm looking at the online documentation for linprog (which if for version R2023a), and I don't see a valid calling syntax that c...

3 years ago | 1

Answered
Bayesian Optimization - Objective Function Model Plot Explained
Step 1: Understand the purpose of the objective function Your ultimate goal, if you are using this plot, is presumably to build...

3 years ago | 1

Answered
Why does cumtrapz give lower magnitude for very thin Gaussian?
I see no surprising behavior here. Combining the plots into one, here are your results: % t domain t_min = 0; t_max =...

3 years ago | 1

| accepted

Answered
How to generate joint frequency table?
It isn't perfectly clear what you mean, but I think this does what you intend. % Set the seed, for reproduciblity rng default ...

3 years ago | 0

| accepted

Answered
Compute standard deviations of predictions of linear and polynomial regression models
I am by no means an expert on gaussian process models, but I don't think that an ordinary least squares regression (fitlm) has t...

3 years ago | 0

Answered
Why do I keep getting this error? "Error using surf Z must be a matrix, not a scalar or vector."
At the risk of stating the obvious, you keep getting that error because Moment is a vector, but it needs to be a matrix. In you...

3 years ago | 0

Answered
unable to login to matlab app using trial version account
For these sorts of issues, it is usually best to contact the MathWorks support team.

3 years ago | 0

Answered
If Else Statement in a Switch function
You didn't end the if clause that is inside the first case statement.

3 years ago | 2

Answered
Extract first and last row of each subarray in a cell array
I believe this does what you want. load cellArray.mat c = cellfun(@(x)unique(x([1 end],:),"row"),group1,"UniformOutput",false)...

3 years ago | 1

Answered
How to identify the repeated elements in an array and delete those rows?
Here is one way: M = [1 100; 2 200; 3 200; 4 200; 5 500]; [~,j] = unique(M(:,2)); out = M(j,:)

3 years ago | 0

Answered
what is the best way to write a script that determines which elements of a sample array ( a randomly generated 4 x4 array) are odd numbers?
Here is one way. % Input M = magic(3) % Row and column indices of the odd elements [row_odd,col_odd] = find(mod(M,2)==1)

3 years ago | 0

| accepted

Answered
shannon entropy and entropy of grayscale
I = imread('image.png'); figure imagesc(I) % Using histogram from imhist p = imhist(I); p = p/numel(I); p(p==0) = []; ...

3 years ago | 1

| accepted

Answered
find maximum distance between a point (outside of polygon) and a polygon?
px = [0 0 1 1]; py = [1 0 0 1]; pgon = polyshape(px,py); x0 = 2; y0 = 0; figure axis equal hold on plot(pgon) plot(...

3 years ago | 1

Answered
Convert negative values to positive values in the graph
Yes, but the answer depends on what exactly you have. Do you have just the image the MATLAB figure file, but not the underlyin...

3 years ago | 0

| accepted

Answered
Is there a built-in function to push my vector
v = [1, 1, 0, 2, 3, 5, -1]; circshift(v,1)

3 years ago | 2

| accepted

Answered
How to create JSON-Code
Will the jsonencode function do what you need? If not, can you be more specific about what you have as input, and what exactly ...

3 years ago | 0

Load more