Answered
How can i put a stopping criterion for this bisection method code in matlab?
f_x= @(x)sin(5*x)+cos(2*x); p_old = 0; % give an initial value to it x_l =2; x_u = 10; x=x_l:0.01:x_u; hold on plot(x,f...

4 years ago | 0

Answered
Is there any mathematical method of curve fitting for cases when the modeling function is unknown (another degree of freedom for the form of the function)?
No, there is no such method. Often, physical considerations are a way to decide for a suitable model function. If this is not ...

4 years ago | 0

Answered
How to generate a random number that is either 100, 200, or 300.
Hint: 100*1 = 100 100*2 = 200 100*3 = 300

4 years ago | 0

Answered
writing the equation of normalize correlation
rng('default') x = 4; y = 5; w = rand(x,y); wstroke = rand(x,y); NC = sum(w.*wstroke,'all')/sum(w.^2,'all')

4 years ago | 0

| accepted

Answered
Nonlinear optimization not working
fun = @(x,y,z) 25*x + 37*y + 48*z; x0 = [0,0,0]; A = [0 -1 2]; b = [0]; Aeq = []; beq = []; lb = [200 200 200]; ub = [...

4 years ago | 0

| accepted

Answered
Getting NaN greater values in a function
warning('off') iterations = [10, 100, 1000]; count = 1; p = 0.5; for n = iterations figure(); hold on; for ...

4 years ago | 0

| accepted

Answered
How to solve 2nd order multiple variable equation with ode45
syms t y1(t) y2(t) syms c2 m1 m2 k1 k2 F eqn1 = diff(y1,t,2) + c2/m1*(diff(y1,t)-diff(y2,t))+k1/m1*y1+k2/m1*(y1-y2)-F == 0; e...

4 years ago | 0

Answered
The plot of a given equation
h=0:0.01:2; Fmax = 37509.41*sqrt(h); plot(h,Fmax)

4 years ago | 0

| accepted

Answered
how to split a 4x3 matrix in half
If the number of columns of arr1 is divisible by 2: arr1 = [1 2 3 4;5 6 7 8;9 10 11 12]; arr1_half = arr1(:,1:size(arr1,2)/2)

4 years ago | 0

Answered
how to write equation in matlab for E(t-tp) where the E is E(t) but introduce a tp delay time.
You will need to make a change in the unit of time in your equations such that the delay time is in the order of 1 - it's not p...

4 years ago | 1

| accepted

Answered
Provide Jacobian matrix to ode15i for solving DAE system
y0 = [1; 0; 0]; yp0 = [0; 0; 0]; options = odeset('RelTol',1e-4,'AbsTol',[1e-6 1e-10 1e-6], 'Jacobian', @Jac_robertsidae); [y...

4 years ago | 1

| accepted

Answered
Define a variable on a spline
n = 3; n1 = n-1; a = 20; b = 10; P = [0 b;0 0;a 0]; x = P(:,1); y = P(:,2); T ...

4 years ago | 1

Answered
bisection method error symbolic
syms y q=20; g=9.8; b=3+y; ac=3*y+y^2/2; f= 1-q^2/(g*ac^3)*b; x1=0.5; xu=2.5; hold on fplot(f,[0.5 2.5]) grid on f =...

4 years ago | 0

| accepted

Answered
Bvp4c Unable to solve the collocation equations -- a singular Jacobian Encountered
clc; p = 0.01; Betaf = 207; Betas = 17; Beta = 0.5; kof = 0.613; kos = 400; m = 1; b2 = 0.5; b1 = 0.5; G1 = 5; G2 = 5...

4 years ago | 0

| accepted

Answered
Third for loop runs, second and third loops do not
If val_T were 1, only the third loop was entered. But we don't know the value of val_T.

4 years ago | 0

| accepted

Answered
Using euler's method to plot x(t) graph
You pass "ICs(z)" and "timeVector" to "eulersub". In the function, they get the names a and b. But a and b are never referenced ...

4 years ago | 0

| accepted

Answered
How to solve this without syms x
fun = @(x) x.^2./(1+sqrt(x)) ; sol = fzero(@(x)fun(x)-2,10); x = 0:0.1:4; plot(x,fun(x),sol,fun(sol),'o')

4 years ago | 0

| accepted

Answered
My code is outputting very illogical answers for the second block (my second vector loop equation).
% given values R1 = 59.7; R2 = 18.8; R3 = 41.0; R4 = 40.1; R5 = 136.4; R6 = 11.9; R7 = 15.6; R8 = 11.7; Rgi = 13.1; Re...

4 years ago | 0

Answered
Graph not being displayed
./ instead of simple / : x=linspace(-5,5,130); y=(2*x.^2-2*x-1)./(x.^4+1); plot(x,y);

4 years ago | 0

| accepted

Answered
Euler Integration Step Size Change
Only integer values can be used for array indexing. The loop must run from i=1 to i=5000 instead.

4 years ago | 0

| accepted

Answered
How can i plot dy/dx function?
xspan = (30:0.1:900); y0 = 0; options = odeset('RelTol',1e-12,'AbsTol',1e-12); [x,y] = ode15s(@(x,y) odefun(x,y), xspan, y0, ...

4 years ago | 0

Answered
What is wrong with the function code when it can work perfectly without function code
Works for me. [k,p,err,P] = fixpt(@(x) sin(x)-1,-1,0.00001,100) function [k,p,err,P] = fixpt(g,po,tol,maxi) % g is the functi...

4 years ago | 0

| accepted

Answered
Error tolerance in matlab
The ode integrators try to guarantee a predefined error tolerance when solving your system of ordinary differential equations. I...

4 years ago | 0

Answered
How do I go by this in Matlab?
%************ Variable declaration****************** rng('default') t = -20:0.1:20; n = 1000; % number of realizations signa...

4 years ago | 0

| accepted

Answered
how can I plot the fourier series of this function by calculating the coeffcients and for different n?
Note that the function f you defined is even - thus it must be cos(n*x), not sin(n*x) that appears in the Fourier series. x = l...

4 years ago | 0

| accepted

Answered
How can I define two function in function handle for GAMULTIOBJ?
Since the functions are that long, better keep them separated. But use func=@(x) [efficiency(x),LCCfunc(x)]; instead of func...

4 years ago | 0

| accepted

Answered
Is my matlab code for the sinc signal below correct.
%************ Variable declaration****************** rng('default') t = -20:0.1:20; signal = zeros(1,length(t)); %for spped a...

4 years ago | 1

| accepted

Answered
Help with 'fmincon' fucntion for optimsation
Your problem is linear. You might want to try "linprog" instead of "fmincon". m = 6; a =[.75,0.75,0.85,0.8]; x0 = [0,0,0,0]; ...

4 years ago | 2

| accepted

Answered
System of Nonlinear Equations exceeds function evaluation limit
Substitute a = x(2)*cos(x(3)), b = x(2)*sin(x(3)), c= x(1)*cos(x(3)), d=x(1)*sin(x(3)) in your equations. You get an underde...

4 years ago | 0

Answered
How do you analytically solve PDE's in Matlab for example the 1-D Poisson Equation
Usually, PDEs cannot be solved analytically in MATLAB. Your "PDE" is a simple ODE with solution phi(x) = 1/2*x^2 + a*x + b with...

4 years ago | 1

Load more