Answered
how can I use my function f to replace a and b with writing all the equation every time? x^3 + a^2*x^2 - 10)*sin(x) - y) like f(a)*f(b)<0
x = 13.61015; y = 13257; a = 5.14; b = 11.47; err1 = 0.000001; f = @(x,y,p) (x^3 + p^2*x^2 - 10)*sin(x) - y ; f(x,y,a) f(...

3 years ago | 0

| accepted

Answered
Why is "fitoptions" returning the error "Too many input arguments"?
fitoptions is part of fittype, not vice versa as you try to do. Thus fitoptions must be define before fittype: options = fitopt...

3 years ago | 0

| accepted

Answered
I'm trying to solve two non-linear equations using fsolve
Variables and residuals must be put into one single vector: [x,fx] = fsolve(@fun,[6;6]) % Set up the functions that will sto...

3 years ago | 0

Answered
Cannot understanding the dimension of XY1
omega_n = 10; omega = 0:0.1:20; zeta1 = 1.0; r = omega./omega_n; XY1 = sqrt((1+(2*zeta1*r).^2)./((1-r.^2).^2+(2*zeta1*r).^2)...

3 years ago | 1

| accepted

Answered
Solving system of transient pdes in 2D space method of lines
Nobody uses ode45 for a system of ODEs that stems from the discretization of a reaction-diffusion PDE. You must use a stiff sol...

3 years ago | 0

| accepted

Answered
How can I get x-y values for a given z coordinate from a 3d surface plot?
If you can get a z-value from (x,y) coordinates by a certain function f, you can get the x-y-coordinates by using an optimizer t...

3 years ago | 0

Answered
How to solve this equation
Use pencil and paper. dy/dt = -(1+2*n)*y -> dy/y = -(1+2*n)*dt -> log(y/y0) = -(1+2*n)*(t-t0) -> y = ?

3 years ago | 2

Answered
Unable to find explicit solution
syms d L R x y phi theta assume (L,'positive') eq(1) = -L*cos(theta) + x == 0; eq(2) = -L*sin(theta) - L/2 + y == 0; eq(3) =...

3 years ago | 0

Answered
How to solve a function with uknown parameter with bisection method
syms x y p eqn = y - (x^3 + p^2*x^2 - 10)*sin(x) == 0; eqn = subs(eqn,[x y],[13.61015,13257]); p = vpasolve(eqn,p); p = p(p>...

3 years ago | 0

Answered
Lateral Deviation Between two curves
The normal to "driven_path" and the "desired_path" do not cross for r(4) < x < r(2). That's why there is a gap in the distance g...

3 years ago | 0

Answered
Use element as indices to continue calculation
data = readmatrix("https://de.mathworks.com/matlabcentral/answers/uploaded_files/1172778/data.csv"); ind=[1,764,1335,1459,2151]...

3 years ago | 0

Answered
Simplifying the algebraic equation
No.

3 years ago | 0

| accepted

Answered
Lateral Deviation Between two curves
desired_path_invers = @(y)sqrt(y-10); true_path_invers = @(y)sqrt(2*y); y = 10:0.1:12000; plot(y,abs(desired_path_invers(y)-t...

3 years ago | 0

Answered
how to make a matrix only showing Permutation without order ?
You mean nchoosek([1:20,25],3) nchoosek(21,3) not 21^3 ?

3 years ago | 0

| accepted

Answered
solving an equation not by sym
Linear system of equations in E(1,1),...,E(n+1) and 2/x. Setup for n = 4 (solution variables are E(1,1),E(2,1),E(3,1), E(4,1), ...

3 years ago | 0

Answered
Comparing each corresponding element of a matrix from multiple vectors
A = [1 2 ; 4 5]; B = [-1 3; 7 -4]; C = [-20 4; 3 -1]; arr = cat(3,A,B,C); max(arr,[],3)

3 years ago | 0

| accepted

Answered
Index exceeds the number of array elements. Index must not exceed 2.
F1 and F2 are scalar values if you define them as you do in your code. Thus F1(x(n)), F2(x(n-1)) makes no sense. Further x(n) a...

3 years ago | 0

Answered
How do I move the center of my cyclinder to a specific point?
r = 5e-7; [X,Y,Z] = cylinder(r); h = 20e-7; Z = Z*h - 2*r; cyl = surf(X,Y,Z,'FaceColor','none'); rotate(cyl, [0 1 0], 90)

3 years ago | 1

| accepted

Answered
How to optimize a function below a given value?
Use OutputFcn to stop the optimizer manually: https://de.mathworks.com/help/matlab/math/output-functions.html

3 years ago | 0

Answered
Index exceeds the number of array elements (24)
clear all clc T=24;%hour P_pv1(1,1:T) = 270; P_pv2(1,1:T) = 140; P_pv3(1,1:T) = 120; P_pv4(1,1:T) = 150; E1(1,1:T) = 7; ...

3 years ago | 0

| accepted

Answered
How to generate a random set of x,y coordinates
xmax = 0.4; xmin = 0.2; zmin = 0.2; zmax = 0.32; xrand = rand(1,400); xinit = xmin + xrand*(xmax - xmin); zrand = rand(1,4...

3 years ago | 0

Answered
use fmincon with 0<x1<x2<x3
Strict inequality is not possible. If you are satified with <= instead of <, use -x1 <= 0 x1 - x2 <= 0 x2 - x3 <= 0 o...

3 years ago | 4

| accepted

Answered
How can I write an objective function with its constrain for optimization?
Put your unknowns in a vector x. Write your function to be maximized as f*x where f is to be determined from your above problem...

3 years ago | 1

| accepted

Answered
Index exceeds the number of array elements. Index must not exceed 1.
You use Em(k) and Em * (k) in this line of code. Both cannot be correct, I guess. Further check out whether E(k) is correct: E ...

3 years ago | 0

| accepted

Answered
How can i use different solvers like ga, patternsearch, particle swarm etc in problem based Mixed integer Linear Programming
MATLAB chooses the solver that is most appropriate (usually means: fastest) for your problem. Why solving a linear optimization...

3 years ago | 0

Answered
Non trivial solution to a linear system
However whenever I use the A\B command to solve the system I get the trivial solution x=[0 0 0 0 0]' and I am told that this sol...

3 years ago | 0

Answered
How do I mulltiply a complex conjugate vector by its second derrivative (also complex) to get a real number?
I don't know why psi*psi'' should be real, but here is a method to avoid shortening "psi". psi = [0.0100 + 0.0172i 0.0106 + 0...

3 years ago | 0

Answered
How do I get these two equations to work in scenarious like this
As far as I know, MATLAB won't perform algebraic manipulations before substituting variables or algebraic expressions. As an ex...

3 years ago | 0

Answered
Need help debugging code
Your input matrix is missing in the call.

3 years ago | 0

| accepted

Answered
Index exceeds the number of array elements (24)
Delete the line for t=t+1 and the corresponding end And why do you set P_pv1 = 270; P_pv2 = 140; P_pv3 = 120; P_pv4 ...

3 years ago | 0

Load more