Answered
Array indices must be positive integers or logical values.
f is interpreted here as an array, and arrays can only be indexed with positive integers or logical values. So f(-6) is forbidd...

3 years ago | 0

| accepted

Answered
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
The usual way to define a function is function [output1,output2,...] = name_of_the_function(input1,iput2,...) Your line of...

3 years ago | 0

Answered
Divided difference in Newton's form error
Whatever your code is supposed to do, add a sixth element to the vector "a" in function "dd": a = [-5, 2, -4, 8, 3, 6]; instea...

3 years ago | 0

Answered
sorting vector by value and position
A = [109 97 116 108 97 98]; [~,p] = sort(A,'ascend'); r = 1:length(A); r(p) = r

3 years ago | 1

| accepted

Answered
Optimoptions - Invalid solver specified error
You wrote 'StepToleance' instead of 'StepTolerance' ...

3 years ago | 0

Answered
Find x and y cordinates and t for z=0
xvel=20; yvel=20; zvel=40; g=-9.80665; t = [0:0.1:10]; xacc = 0; yacc = 0; zacc = g; sx = xvel*t + (0.5 * xacc*t.^2); s...

3 years ago | 0

Answered
Error using plot Vectors must be the same length.
Replace mf = [mf1 mf2 mf3]; by mf = [mf1; mf2; mf3];

3 years ago | 0

Answered
Calculate the next 2 numbers in the sequence
u_(n+2) = 4*u_(n+1) + 2*u_n If you insert n = 0, you get u_2 = 4*u_1 + 2*u_0 So what is u_2 given that u_0 = 3 and u_1 = 2 ? ...

3 years ago | 0

| accepted

Answered
Trying to find the Euclidean distance of 2 vectors with different sizes
T =[5.1000 3.5000 6.4000 3.2000 5.4000 3.4000 5.7000 2.8000 5.7000 4.4000 5.6...

3 years ago | 0

Answered
Function for ODE45 requires all coefficients be written in it
tspan = linspace(0,35,35000); f0 = [1; 1; 1; 1; 1; 1; 1; 1]; a = 2; g_p = 3; g_s = 105; g_a = 0; g = 1; k = 250; P = 0; O_z = ...

3 years ago | 1

Answered
Making a horizontal region between two functions
f = @(x) x.^3; g = @(x) x.^(1/3); a = 0; b = 1; hold on fplot(f,[a,b]) n = 20; for i = 1:n+1 start = [g((i-1)/n*b),1];...

3 years ago | 0

Answered
Set initial condition to time different to 0
This is a boundary value problem, not an initial value problem. Thus you should use bvp4c instead of ode45.

3 years ago | 0

Answered
Finding the minimizer using fminunc.
fv = @(x) x(1)^2 + x(1)*x(2) + (3/2)*x(2)^2 - 2*log(x(1)) - log(x(2)); [minimizer,minimum_value] = fminunc(fv,[1; 1])

3 years ago | 0

| accepted

Answered
Testing if Data is close to the Exponential Distribution
How can I take this data and see if it is exponentially distributed? There is no way to do so. Also, how can I find how far t...

3 years ago | 1

| accepted

Answered
Nonlinear equations with two variables and a changing parameter
%The below is a system of nonlinear equations with two variables x, t, and %a changing parameter V. 0<x<0.2, t is around 6.3e6,...

3 years ago | 0

| accepted

Answered
Solving a system of equations using the solve function in a for loop?
Remove all the (t) in the symbolic variables, so use syms q TPCM Toil_PCM_to_EG instead of syms q(t) TPCM(t) Toil_PCM_to_EG(...

3 years ago | 1

Answered
How to fit parameters of an ode by using ode45 and fmincon
Check your differential equations. As you can see, the derivatives for the given constellation (parameters and initial condition...

3 years ago | 1

| accepted

Answered
Solve Command giving wrong numbers for certain values, but gives perfect answers for the rest?
As you can see, there are two solutions for angle_3 and angle_4. Seems you took the wrong one for 290-330 degrees. syms angle_2...

3 years ago | 0

Answered
3 state space model time discretization
x_dot = A*x + [B,C]*[u;v] So define A_ss = A, B_ss = [B,C]

3 years ago | 0

Answered
Steady-state solution for system of parabolic PDEs?
Since this gives a system of second-order ODEs in general, the usual code to try would be "bvp4c".

3 years ago | 0

| accepted

Answered
Fitting curve of curve with parametric representation to measured data
opt = fmincon(@(S)Fehlerberechnung_Kreisevolvente(S(1),S(2),S(3),S(4)), [2,0,0,0]) instead of opt = fmincon(@(S)Fehlerberechnu...

3 years ago | 0

| accepted

Answered
When coding of function that shows error in yellow underline.
If f is a function handle, this line of your code doesn't make sense: if fc > f Only the result of function handles applie...

3 years ago | 0

Answered
Getting A blank Graph
I changed y3 to what I think you meant. x=0:0.01:1; y1=(0.5*x.^5)-(0.6*x.^4)-(0.6*x.^3)+(0.3*x.^2)+0.25; y2=(sin(x).*cos(x))...

3 years ago | 1

| accepted

Answered
after runing this function, i only see the result of t{1}.. in the command window but not in the workplace so i can't use this value , does anyone know why?
Output T to the calling program - then it will appear in the workspace: D=[0 0 0 pi/2; 0 5 0 pi/6; 0 5 0 pi/2]; T = ...

3 years ago | 0

| accepted

Answered
Integration of elements of a matrix
syms x x1 x2 x3 x4 x5 x6 F3w F4w F5w F3p F4p F5p assume([x x1 x2 x3 x4 x5 x6 F3w F4w F5w F3p F4p F5p],'real') L2=60000; L1=4...

3 years ago | 0

Answered
Solving Heat equation using pdepe does not give credible results
m=1; xmesh=linspace(0,270E-6,270); tspan=linspace(0,2,50); sol=pdepe(m,@pdefun,@icfun,@bcfun,xmesh,tspan); u=sol(:,:,1); fi...

3 years ago | 0

| accepted

Answered
Points inside the sphere
Hint: Use the function fun = @(x,y,z) ((x-X)/a).^2 + ((y-Y)/b).^2 + ((z-Z)/c).^2 - 1.0;

3 years ago | 1

Answered
solving a system of equations
M1=3 P1=101325 %pa or 1 atm theta2 = .349 %rad or 20 degrees theta3 =.262 %rad or 15 degrees %first get P2 and P3 %area 2 ...

3 years ago | 0

Answered
How can I plot two functions in the same graph?
fplot(@cosh) hold on p = @(x)0.6671*x.^3-1.7921*x.^2+2.7580*x-0.089; fplot(p) hold off

3 years ago | 0

| accepted

Load more