Answered
Solve Equation and Plot it
Easy peasy. Essentially one line of code once you define the various constants. syms f_1 f_2 alpha = 0.4207; skalar = 4.5375;...

18 dagen ago | 0

Answered
Declrarion of an array using tilde (~). what is the correct way of using it, because my code prompts me incorrect use of tilde.
This is a test: if i == D(k) It is the correct way to use == because == is a comparison operator. However, this other line is...

19 dagen ago | 1

Answered
Methods to create arrays of NaN
A NaN is a nan. A NaN by any other name, is still just a NaN. But there are faster and slower ways to make them, and surely the...

20 dagen ago | 0

Answered
maximization problem , fmincon optimization
syms x y objxy = ( -.858*x-.04182*y-1.645*sqrt((.5882*x -.055*y).^2 + (-.0558*x +.352*y).^2 )); If x+y == 1 then we can replac...

22 dagen ago | 1

| accepted

Answered
How can I plot f(x,y) in xy plane
help fsurf

25 dagen ago | 0

| accepted

Answered
Should we always search for the global minima in our optimization problem?
Yes. And, no. Amazing how the anwer is often, well, it depends... You do want to find the true global min. Yes, that makes sens...

26 dagen ago | 0

| accepted

Answered
Find smallest Eigenvalue and the corresponding eigenvector.
Just compute the matrix Ainv = inv(A); Now use your code on the matrix Ainv. This works because the smallest eigenvalue is no...

26 dagen ago | 1

| accepted

Answered
How to store values in summation for loop?
You understand how to index a variable, thus k(i). But when you write this: s = s + (stuff) It increments ALL elements of the ...

26 dagen ago | 0

Answered
probability distribution from a simple vector
Note that the use of meshgrid is wildly inefficient, if all you want to know is count the frequency of one number following anot...

27 dagen ago | 0

Answered
How to interpolate a matrix of 1x10 into 18x1800
You can't. That is, you cannot interpolate the singleton dimension into something of size 18. As a point of comparison, suppose...

29 dagen ago | 0

Answered
operator '*' is not supported for operands of type 'function_handle'.
This question (or the equivalent) gets asked over and over again. I can understand where things get confusing. For example: f =...

ongeveer een maand ago | 1

Answered
Why does MATLAB (Symbolic Math Toolbox) not integrate this simple function.
Your problem is, you need to define a properly. So, if you do only this: syms x a I = int((1-x^2/a^2)^(3/2),x) Now you see th...

ongeveer een maand ago | 1

Answered
How to generate a matrix with random numbers between 0 and 1 and mean of the distribution is unspecified.
You need to understand the difference between a sample mean, and the population mean. x = rand(1,100); mean(x) This is a rand...

ongeveer een maand ago | 0

Answered
fmincon solution different for different start values
There are many scenarios where a solver can produce different solutions for different start values. First, know that fmincon is ...

ongeveer een maand ago | 0

Answered
Spline vs Linear Interpolation
This is not remotely a question about MATLAB. I'll answer it only because I have some time, and because I do understand interpol...

ongeveer een maand ago | 1

| accepted

Answered
Quadratic spline having shape preserving property
You cannot define a shape preserving quadratic spline that is differentiable across the breaks. So while you think you want it,...

ongeveer een maand ago | 0

| accepted

Answered
How to optimize the solution of one optimization function using another?
Why do you think this has any remote reason to converge? Consider this trivial example of a pair of problems, based exactly on t...

ongeveer een maand ago | 0

Answered
reading the numbers resulting from the loop
Why would it mean anything else? That is, what is the product of the numbers 10^4*2.2567? 10^4* 2.2567

ongeveer een maand ago | 0

Answered
What to do when solving a system with a sparse matrix and a dense matrix results in a singular matrix, even after normalization?
Normalizing the matrix in some way will not help. In fact, it might invalidate the FEM solution, depending on what you did. Sinc...

ongeveer een maand ago | 1

| accepted

Answered
Plot figure for f(y,z)=0
Simple enough. Define the two functions. Then subtract them, and plot using fimplicit. f = @(z) 0.07*z.^2./(0.09 + z.^2); g = ...

ongeveer een maand ago | 1

Answered
Formulate an objective function with summation terms to solve a linear programming problem
Why would you need fmincon on a purely linear problem? u and v may be different vectors in your eyes, but they can trivially b...

ongeveer een maand ago | 0

| accepted

Answered
Solve differential equation from Matlab
Making various assumptions, we see the solution as: syms ka kd C xmax syms x(t) dsolve(diff(x) == (ka*C*(xmax-x)-kd*x)/(1+ka*...

ongeveer een maand ago | 0

| accepted

Answered
Obtaining the combinations of a vector array to satisfy lineal constrains.
Is it possible? Of course. Exhaustive enumeration. Just try all combinations, saving those that work. Is that easy? OF COURSE NO...

ongeveer een maand ago | 0

Answered
Random number generation with min, max and mean
Sigh. I've probably seen different variations of this question asked at least many hundreds of times over the 40+ years I have b...

ongeveer een maand ago | 0

| accepted

Answered
fit tool with errors in x and y
You can't. Period. You cannot use fit to solve a problem with errors in both x and y. That does not say the problam is never sol...

ongeveer een maand ago | 0

Answered
roots(x) vs root= interp1(y,x,0)
You need to understand the mathematics. Lost you will be without that (to misquote someone named Yoda.) For this polynomial: s...

ongeveer een maand ago | 0

Answered
How to create random matrix with specified step in interval [a, b]
You can also use indexing. The idea is to generate random indexes. ValidRandomSet = 5:3:34 m = 7; n = 6; ind = randi(numel(V...

ongeveer een maand ago | 2

Answered
Interpolate using a different method without the original image
Um, no, or, yes. Anyway, you cannot do it directly. And it may be completely impossible to do. All of that depends on several th...

ongeveer 2 maanden ago | 0

Answered
How to find the volume of cross-sectional area of a cylinder
Is there a ready made function that will do the mathematics for you, based only on an inequality? No. You will need to do some m...

ongeveer 2 maanden ago | 0

| accepted

Answered
Error solving bvp4c - Singular jacobian
You have a simple classical ODE, with two INITIAL conditions, not boundary conditions at different ends. So use a tool like ODE4...

ongeveer 2 maanden ago | 0

Load more