Answered
Iterating an equation through a range of values to satisfy a condition
count = 0; for X = 11:15 % Needs to be a range of values from 11 to 15 count = count + 1; X_array(count) = X; ...

3 years ago | 0

Answered
Question on DDE23
lags=1; tspan=[0 10]; sol = dde23(@ddefunc,lags,[0.8; 0.2],tspan); plot(sol.x,sol.y(1,:)) function yp = ddefunc(~,y,Z) ...

3 years ago | 1

| accepted

Answered
solving 1D parabolic-elliptic equations with one initial condition
Supply an arbitrary initial condition for the elliptic pde - if possible one that satisfies its boundary conditions. If pdepe a...

3 years ago | 0

Answered
How to solve multiple equation and get all value of the variable?
p1 can be chosen arbitrarily since the corresponding column in the matrix A is zero. (I set p1 = 1). Note that sol does not sa...

3 years ago | 0

| accepted

Answered
How can i plot this function? y=0.75/(log10(x)*2).^2
What do you mean by "in 2D" ? It is a simple function to be plotted y vs. x: x = 2:0.01:5; y = 0.75./(log10(x)*2).^2; plot(x,...

3 years ago | 0

Answered
Mean distance function upgrade question
Don't know if you have enough RAM for this. Note that the distance matrix pdist2(group1,group2) will be 70000 x 80000 in your ca...

3 years ago | 1

Answered
How would I use the 'count' function but to only count instances of both columns being specified?
x_y_= [1 4; 5 3;9 8; 2 7;1 8;7 2; 2 7;1 5;4 3]; n = nnz(ismember(x_y_,[2,7],'rows'))

3 years ago | 0

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

Load more