Community Profile

photo

Alan Stevens


Last seen: 1 dag ago Active since 2020

Statistics

  • 12 Month Streak
  • Guiding Light
  • Knowledgeable Level 4
  • First Answer

View badges

Content Feed

View by

Answered
Solve the IVP y′′′=sin(y2)+y′+cos(t), provided with an appropriate set of initial conditions of your choice, and using Matlab's ODE45 function.
Like this? (Note the IC for d^2y/dt^2 must be consistent with the values chosen for y(0) and dy(0)/dt). Change the IC's and tim...

8 dagen ago | 0

Answered
Need Help Solving System of ODEs
You haven't included the first term on the right-hand side of your equation for dV/dt, nor for dgamma/dt.

10 dagen ago | 1

Answered
spring mass using ode45
Like this x0 = [0; 0]; tspan = [0, 10]; [t, x] = ode45(@func, tspan, x0); subplot(2,1,1) plot(t, x(:, 1)); grid('on...

10 dagen ago | 0

Answered
I am getting error in this program. Please suggest the corrections.
Change c = [1 2 2 3 4 5 6 7]; to c = [1 2 3 4 5 6 7];

10 dagen ago | 1

Answered
Hello, I'm trying to plot one non-piecewise function and two piecewise functions in one graph but I keep getting an error. I don't understand the two error messages below.
You need to put the non-local functions at the end, as in the following. There were several other errors. I don't know if my co...

11 dagen ago | 0

Answered
How to Solve equation using Eulers method in Matlab?
Here's part (a) for you - definitely not a straight line!

13 dagen ago | 0

| accepted

Answered
How to get one output for each input into an equation in MATLAB?
mu = mu_max * (x./(x+Ks)); % Notice it is ./ not just /

18 dagen ago | 0

Answered
How to solve 'Index number exceeds number of array elements(1)'
You don't update XSOL, so when ct is 2, XSOL(ct) doesn't exist.

18 dagen ago | 0

Answered
A question about FitzHugh-Nagumo model
Like this? tspan = [0 100]; v0 = 0; w0 = 0; IC = [v0 w0]; A=0.5; B=0.05; Epsilon=0.005; I=@(t)sin(t); %%%%%%%%%%%%%%...

19 dagen ago | 0

| accepted

Answered
How to find parameters that minimize a difference
Use fminsearch and use the norm of the differences. help fminsearch

20 dagen ago | 2

Answered
I want to combine 2 variables in matlab into one variable
If they are imported as, say, c1 and c2, then you can simply write c = [c1; c2]; then delete the c1 and c2 if you don't need t...

20 dagen ago | 0

| accepted

Answered
How can i call an equation and it's derivative inside a matlab function?
Like this, perhaps: % TC is given in terms of percentage! x0=0; TC=10^-4; error=TC+1; i=0; x(1)=x0; while(error>TC) [f...

20 dagen ago | 0

Answered
simple Fixed Point Iteration
Probably more like this (though you don't seem to have used function f anywhere): n = 11; x = zeros(1,numel(n)); ea = zeros(1...

21 dagen ago | 0

| accepted

Answered
I want Estimate log to the base 10 value using 'x' number such that 10^estimated value is equal to or just exceeding x.
< not <= a = log10_bywhile( 50, 0.1 ) b = log10_bywhile( 100, 1 ) function [out] = log10_bywhile(x, inc) esmt = 0; % if...

23 dagen ago | 0

| accepted

Answered
How can I change the value of Y in the columns whare the value of X is zero in matrix ?
Like this XY = [1 5 0 10 3 26 0 5]; XY(XY(:,1)==0,2) = 1.5

24 dagen ago | 1

| accepted

Answered
How to switch to this graph? Mathematical question
Try: plot(x,c,x,1-b)

24 dagen ago | 0

Answered
multiple equations multiple variables solve command does not work
These equations are linear in the unknowns, so can be solved as follows: % M*X = V where X = [b; d; e] % and the coefficien...

25 dagen ago | 1

Answered
Is there an error in the if else statement?
Yes, among others! See: L1 = 16.87; %cm L2 = 60.35; L3 = 16.81; L4 = 63.06; L5 = 42.62; L7 = 19.64; theta_1 = 105.47; %de...

27 dagen ago | 1

| accepted

Answered
Solving ODE Boundary Value Problem by Finite Difference Method
I think you just need to change b(i+1) = (w*xi(L-xi))/(2*E*I); to b(i+1) = (w*xi*(L-xi))/(2*E*I); ...

28 dagen ago | 1

| accepted

Answered
Computing the double integral of a surface
Like this syms x y z = @(x,y) x.^2 + y.^2; surface_int = integral2(z,1,2,4,9); disp(surface_int)

28 dagen ago | 0

| accepted

Answered
Mod Euler Method with two ODEs
Like this %Mod_Euler_method Modified Euler's method % [t, w, h] = euler_method(f, a, b, alpha, n) performs Modified Euler's me...

ongeveer een maand ago | 0

| accepted

Answered
im having trouble finding the right values for this codes
This should allow you to find the right values, though it might not be quite the way you were tasked to do it! %Initial Conditi...

ongeveer een maand ago | 0

Answered
Break the for loop
Something like this perhaps: fib = [1; 1]; its = 0; keepgoing = true; while keepgoing its = its+1; r = rand; ...

ongeveer een maand ago | 0

Answered
How to take data on a column matrix (2661 x 1 double) for every 4 row then 3, sequently? So we take data only row 1, 5, 8, 12, 15, 19, 22, ... etc? Thank you.
Here's one way. There's probably a neater way. data=rand(1,2661); n = ceil(2661/3.5); ptr(1)=1; for i = 2:n ptr(i) = 4*(...

ongeveer een maand ago | 0

| accepted

Answered
Random draws from conditional multinomial distribution
Something like u = rand(1) if u<0.2 d = 0; elseif u<0.7 d = 2571; elseif u<0.9 d = 2571^2; else d = 25...

ongeveer een maand ago | 0

| accepted

Answered
How to define and plot a function with input range?
Like so: pt = @(t) (1 ./ (1 + t .^ 2)).*(t>=-0.5).*(t<=0.5); x = 0:0.01:10; y = 2*pt(x-1) + 4*pt(x-2) + 3*pt(x-3) + pt(x-4); ...

ongeveer een maand ago | 0

| accepted

Answered
Plot the slope of a parabola with only the data points being known
Like this? x = linspace(-0.5,0.5,25); %length in (meters) def_3mm_no_grav = -[0.00 5.82e-1 1.08 1.53 1.94 2.30 2.62 2.89 3.12 ...

ongeveer een maand ago | 1

Answered
SIRE with vaccine model
Like this tspan = [0 1.5]; options = odeset('Refine', 10, 'RelTol', 1e-4); y0 = [5185000*0.3 5185000*0.7 1 1 0 0 0 0]; [t,...

ongeveer een maand ago | 1

| accepted

Answered
Problem with fplot function - displays grey zone instead of functions
Change all the ^ to .^ (i.e. dot^)and the * to .*

ongeveer een maand ago | 1

Load more