0

I'm learning python, numpy and scipy. I'm wonder if it is possible translate this kind of functions in matlab to python:

function [tT, u ] = SSolve5TH(n, t, t0,tf,u_env,utop_init, utop_final,ubottom,te_idx) options = []; [tT,u] = ode23s(@SS,t,u_env,options,@B); function y = B(x) y = zeros(n,1); if x >= t(te_idx) y(1,1) = utop_final; y(n,1) = ubottom ; else y(1,1) = (x - t0) / ( tf - t0) * (utop_final - utop_init) + utop_init; y(n,1) = ubottom ; end end function rp = SS(t,r,B) global AH rp = AH * r + B(t); end end 

In this example, n is number, e.g 15;

t is the time array

AH = [15]x t matrix

t0 = 0

tf = 20 (e.g)

u_env = [20,20,20,20,20,20,20,20,20,20,20,20,20,20,20]

utop_init = 20

utop_final = 40; ubottom = 20;

te_idx = 4;

2
  • This is probably possible. What did you try and what problems did you encounter? Commented Mar 15, 2012 at 11:28
  • Problem starts with ode stiff implementation ! Commented Mar 15, 2012 at 12:24

1 Answer 1

1

Yes, it's possible. Along these lines:

http://scipy-central.org/item/13/2/integrating-an-initial-value-problem-multiple-odes

Just replace 'vode' with 'zvode'. Or:

https://stackoverflow.com/search?q=%5Bscipy%5D+complex+ode

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.