Irregular intervals inside a for loop
There are multiple ways to do this. For example: P = primes(20); % Note that P is a ROW vector P SumP = 0; for P_i = P Su...

2 meses ago | 0

Highlighted

Counting the passengers on a train: solving a basic problem using MATLAB
I saw this problem online recently. <https://www.youtube.com/watch?v=-rbozrj9poo Passenger distribution on a train> Not a...

2 meses ago | 6

Which triangulation method does alphaTriangulation?
An alpha shape starts with a Delaunay triangulation. Then some parts of it are deleted as defined by the alpha shape. (Having wr...

2 meses ago | 0

Locate index and weights for linear interpolation for a monotonically increasing vector
I cannot compare your code to something meaningful because your code is not complete. It lacks mustBeLogical, and possibly other...

2 meses ago | 1

Solving 3 equations with 3 unknowns using for loop ?
syms Xb Xm a E1 = (Xb-Xm*25e-3)*(-230.6815e-6*a) == (1.05e3-1.01038e3)*9.81*1.2566e-6 ; E2 = (Xb-Xm*50e-3)*(-108.65e-6*a) == (...

2 meses ago | 1

Can the equations in the differential equation group be represented by symbols when matlab ode solves the differential equation group ?
Sorry, but the numerical ode solvers, such as ODE45 are NOT symbolic tools. They CANNOT solve an ode with symbolic parameters. P...

2 meses ago | 0

How to I find x in sin(x) = 0.65
Simple enough. I'll use solve, since you mentioned that. What happens if you just call solve? syms x solve(sin(x) == 0.5) So ...

2 meses ago | 1

How do I create this full diagonal matrix
What are you doing with the matrix x, once you create a matrix with the diagonal in question? Does MATLAB know what you are doin...

2 meses ago | 0

Polynomial surface fitting problem with constraint y <=1
You have the model: y = a*x1^b + c*x2^d I'll assume that x1 is temperature, and x2 is current discharged. You have told u...

2 meses ago | 1

| accepted

Is it posible to solve system of differential equations with piecewise function inside?
Well, actually, yes you can solve the problem using a numerical ODE solver. That is trivial. For example, consider the simple pr...

2 meses ago | 0

how to get common range for several intervals
Please stop asking the same question over and over again. Finding the sub-interval that covers the maximum number of intervals...

2 meses ago | 1

A set of data has two large intervals, can it be divided into two sets of data? Thanks for your answer.
Are you asking how to divide this into two separate curves, the upper half, and the lower half? I can only assume that is your g...

2 meses ago | 1

| accepted

Writing a script for Goldbach's Conjecture
Let me suggest you are starting from the wrong end? Instead, start with all primes less than your target maximum, so 1000. Can ...

2 meses ago | 0

who does logical works
When something is too big or complicated, TAKE IT APART. TRY IT. x= [ 2 3 4 8 10 0 -2] So x is a vector of integers. What doe...

2 meses ago | 1

CRT gamut solid
Not totally pertinent, but years ago, I built a solid model of some gamuts. I no longer have it, since I gave it away when I ret...

2 meses ago | 1

Backslash for inverse to solve Ax=B
When you have a singular system, then pinv and backslash will both attempt to solve the problem, to the extent they can. I seri...

2 meses ago | 0

| accepted

how do i write commands for errors and warnings in Matlab
You wrote code for an ERROR message. If you don't know if it is correct, then TRY IT! Does it do as requested? An error termina...

2 meses ago | 1

How to get the expression of a 3d surface
Congratulations! You are the one millionth person to ask this same question. Your reward for this is a one way, unpaid trip to N...

2 meses ago | 0

Failure in initial objective function evaluation. FMINCON cannot continue.
You need to read the examples. Look at the help for fmincon. Why? What is nvars? nvars = 2; nvars is the scalar 2. I assume y...

2 meses ago | 0

| accepted

Alternating forward and reversed cos function
This may be easier than you think. But since you asked, and had no idea how to do it, it may be harder than you think. DRAT. Now...

2 meses ago | 0

| accepted

How to calculate R^2 based on external linear equation?
Unfortunately, R^2 is not a completely simple concept when working with an orthogonal regression. To compute a valid R^2, we nee...

2 meses ago | 2

How can i graph these equations?
None of the solutions you tried are correct, because they try to treat these functions as single valued relations. That is not t...

2 meses ago | 0

Count number of digits after decimal point?
MATLAB does not distinguish between numbers with trailing zeros after the decimal point. That is, 0.25 == 0.250 == 0.250000000. ...

2 meses ago | 1

| accepted

Factoring out a smaller equation, using symbolic math, from a larger equation
You were using collect in the wrong way. You were thinking in terms of what you wanted to see INSIDE the parens. Instead, you ne...

2 meses ago | 0

| accepted

How can I set bounds for ga that change with the values of the optimization variables?
You cannot. Bounds are FIXED constants. They do not vary at all, and the optimizer assumes that as fact. If you have a constrai...

2 meses ago | 1

| accepted

What do I do to upgrade from MatLab 2013a to run-on MacOS Catalina
What can you do now? Looking at the system requirements page, we see that R2019b is the oldest release supported for Mac OS 10....

2 meses ago | 0

how to get convolution for two signals without using conv command
Several ways you could do this. If your signal is represented as a discrete sequence, then just use a double loop, accumulating ...

2 meses ago | 0

Countering error while using interp1 function
Your problem is NOT in interp1. It is in the incorrect use of datetime. Read the error message: Error using datetime (line 597)...

3 meses ago | 2

| accepted