Answered
How to fit a smooth curve on discrete data.
Maybe something like this: x = [3, 2.5, 2, 1.5, 1, 0.5]; y = [1.8, 1.75, 1.71, 1.55, 0.8, 1.25]; plot(x,y) xx = linspace(x(1...

3 years ago | 0

| accepted

Answered
Using ODE Event locations: how to implement more than one event with different following solver decisions?
sol.ie as return parameter from the solver indicates which of the events you defined became active. According to this value, the...

3 years ago | 0

| accepted

Answered
How can I solve a Lagrange equation?
syms x1 x2 x3 lambda g = x1+x2+x3 - 10; L = 12*x1-x1^2+8*x2-x2^2+18*x3-3*x3^2+lambda*g; Lx1 = diff(L,x1); Lx2 = diff(L,x2); ...

3 years ago | 0

| accepted

Answered
How to plot function f(x,y,z)=c ?
c = pi/2; f = @(x,y,z) cos(x) + cos(y) + cos(z) - c fimplicit3(f,[-pi pi -pi pi -pi pi])

3 years ago | 1

Answered
Curve fit but only for the values that exists with defined values of x.
load census I = cdate >= 1850 & cdate <= 1950; cdate1 = cdate(I); pop1 = pop(I); plot(cdate,pop,'o') %Create a fit option...

3 years ago | 0

| accepted

Answered
How to find the timestep in ode45?
p(t) represents injection into the body at a rate of 2mg/min. So p(t) depends on the difference between the current and previo...

3 years ago | 0

Answered
error in fminbnd and in my live function
Don't you have to include the circular area G = pi*r^2 at the bottom ? Then add pi*r^2 to A as indicated below. V = 10; % c...

3 years ago | 0

Answered
Solving a PDE symbolically
First check whether (dH/dx1,dH/dx2) is conservative. Then you can reconstruct H by using H(x1,x2) = H(x10,x20) + integral_{z=x...

3 years ago | 0

| accepted

Answered
Not sure how to go farther with this problem.
n = 8; TD = zeros(n); for row = 2 : n-1 TD(row,(row-1):(row+1)) = (row-1):(row+1); end TD You will have to add the set...

3 years ago | 1

Answered
how to plot the gradient of a equation having specific region?
x = -2:0.1:2; y = x; [X,Y] = meshgrid(x,y); f = @(x,y) -15*x.^2+4*y; surf(X,Y,f(X,Y))

3 years ago | 0

Answered
Differential equation not working
I = @(t)100*sin(2*pi*t);; dIdt = @(t) 2*pi*100*cos(2*pi*t); V0 = 0.1; fun = @(t,V,I,dIdt) V/I(t)*dIdt(t)-V/0.01*(V*I(t)/250-1...

3 years ago | 0

Answered
what is the problem of my code doing inverse Poisson cumulative distribution?
lambda = 10; u = 0.6; m = iPoisson(lambda,u) m1 = icdf('Poisson',u,lambda) function m = iPoisson(lambda,u) if u == 1 ...

3 years ago | 0

| accepted

Answered
2D Finite Difference Method
K_11 = (f1(a(1,i)+h,a(2,i))- f1(a(1,i)-h,a(2,i)))/(2*h); K_22 = (f2(a(1,i),a(2,i)+h)- f2(a(1,i),a(2,i)-h))/(2*h); K_12 = (f1(a...

3 years ago | 0

| accepted

Answered
programming and plot equarion
z = -5:0.01:5; f = 2*z/sqrt(pi).*hypergeom(0.5,1.5,-z.^2); plot(z,f)

3 years ago | 0

| accepted

Answered
please guide me how to make plot from –pi to pi.
k = 6 + 6; size = 30 + 9; t = linspace(-pi,pi,1000); X = size * cos (k*t) .* cos(t); Y = size * cos (k*t)...

3 years ago | 1

| accepted

Answered
How do fix this code to give me the error?
Cp = @(T) .00000000747989.*T.^3-.000028903.*T.^2+.0423484.*T+36.1064; H = @(T) 1/4*.00000000747989.*T.^4-1/3*.000028903.*T.^3+1...

3 years ago | 0

Answered
Plotting symbolic equation along an array.
Is the really the function you calculated the Fourier series of ? L = 10; nx = 100; nmax = 200; x = (linspace(0,L,nx)).'; n...

3 years ago | 1

Answered
How to run a while loop 1000 times
iter = 0; while t < T && iter < 1000 iter = iter + 1; ... end

3 years ago | 1

| accepted

Answered
How to get u(x, t) at all positions at time t while using pdepe to solve a set of pde equations
@Qianming Yan And Z_m(u,t) is the solution of the pde system you are aiming at ? I'd suggest an iterative procedure: Solve th...

3 years ago | 0

Answered
Bi Level Optimization (solve unable to obtain explicit solution)
I couldn't test it: syms x y z t s %x y z upper level optmization variables and t s are lower levels % Upper Level Optimizatio...

3 years ago | 1

Answered
How do I use two vectors of velocity and time and a for loop to find distance?
I'd suggest vel=[10,15,17,18]; % velocity [km/h] time=[0.5,1,2,3]; % time [h] vel = [0,vel]; time = [0,time]; distan...

3 years ago | 0

Answered
calculating conditional probability in Matlab
These questions aim at exact results for the probabilities. So you must know the formulae how to calculate these probabilities....

3 years ago | 0

Answered
How to extract values at particular interval ?
A = rand(180,360,48); B = [1,5,9,13,17, 21, 25, 29, 33, 37, 41, 45]; A = A(:,:,B); size(A)

3 years ago | 0

Answered
I tried to create a mid point formula and trapezoid formula in Matlab and solve a integral using it but I'm not getting the same result as the build in function.
a = 0; b = 20; h = 1e-2; x = a:h:b; y = exp(-x.^4); x_mid = a+h/2:h:b-h/2; y_mid = exp(-x_mid.^4); format long trapz_for...

3 years ago | 1

| accepted

Answered
calculating probability in Matlab
p = sim() 5/36 function p = sim() N = 10^3; k=0; for i=1:N p=randi(6,1,2); if sum(p)==8 k=k+1; ...

3 years ago | 0

| accepted

Answered
How do you make a script which uses the third- order Runge- Kutta scheme to solve for y'
A class mate of yours seems to have the same problem: https://de.mathworks.com/matlabcentral/answers/1827643-function-uses-the-...

3 years ago | 0

Answered
finding probability in Matlab
You didn't define p (which should be k/1000000). But instead of 1000000, you are told to use N = 10^3 , aren't you ? And the v...

3 years ago | 0

Answered
Problem is unbounded with linprong
You solved it - f can be made as small as you like. That's what "Problem is unbounded" means.

3 years ago | 1

Answered
Solve equation using a loop
s*A*k^alpha + (1-delta)*k = k -> s*A*k^alpha - delta*k = 0 -> k*(s*A*k^(alpha-1) - delta) = 0 -> k = 0 or k = (delta/(s*A)...

3 years ago | 0

Answered
How to convert image from Cartesian to polar coordinate?
https://de.mathworks.com/matlabcentral/fileexchange/98114-cartesian-to-polar-image-transform

3 years ago | 0

Load more