Answered
Cannot simplify a result
You got a "numerical" result. But because the result is symbolic, that is the symbolic result. pi, and square roots are as you w...

4 years ago | 0

Answered
before running the code then Px would be considered to be a variable instead of a function. You might have assigned something to Px in an earlier version of the code and not c
for i = 0:len-1 dif = a(i+1,1) - a(i,1) i starts out at 0 in the for loop. Does MATLAB alow a 0 index for an array? (NO.)...

4 years ago | 1

Answered
How to speed up the code to check if randomly generated number in a certain range is a prime ?
The simple answer is to generate the primes in that range, ALL of them, and then look to see which of your randomly generated el...

4 years ago | 0

Answered
swapping two matrices with similar randomness
You just need to learn how to use indexing. A = [1 2 3 4 5]; B = zeros(5,2); B(:,2) = A/10 Note that even thoiug...

4 years ago | 0

Answered
how to set a loop to calculate time
EVERY pass through your loop, you REDEFINE the variable t. Learn to use MATLAB. Stop thinking in terms of loops for everything. ...

4 years ago | 0

Answered
I need to find a way to plug in unknown values into a function I curve-fitted to known data.
This is not as hard as you make it seem. (Honestly, I tend not to use cftool at all. I just use fit.) Look at the menu options....

4 years ago | 0

Answered
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...

4 years ago | 0

Discussion


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...

4 years ago | 8

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 1

Answered
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) == (...

4 years ago | 1

Answered
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...

4 years ago | 0

Answered
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 ...

4 years ago | 1

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 1

| accepted

Answered
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 ...

4 years ago | 0

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 4

Answered
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...

4 years ago | 0

Answered
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. ...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

| accepted

Load more