Community Profile

# Torsten

2 372 total contributions since 2013

View details...

Contributions in
View by

How do you get ten random values between -pi/2 and pi/2
theta = -pi/2 + rand(10,1)*pi

environ 3 heures ago | 0

How do I differentiate this function?
syms Z K gamma eta alpha NRC EOS1 v X R EOS2 NRM Y= Z*K^gamma*((1-eta)*((1-alpha)*NRC^EOS1+alpha*(X^v+R^v)^(EOS1/v))^(EOS2/EOS...

environ 4 heures ago | 0

Tensor product of three matrices
M = kron(A,kron(B,C)) or M = kron(kron(A,B),C)

environ 4 heures ago | 1

| accepted

How do I assign part of a matrix to be a variable
A1 = A(1:3,:); A2 = A(4:6,:); A3 = A(7:9,:);

1 jour ago | 0

Solving partial differential system
s= [-v*DuDx(1)-psi*km*(qe-u(2)); km*(qe-u(2))]; function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t) Q=2.5; %mL min^-1 A_c=1.96e...

1 jour ago | 1

| accepted

I need matlab code for cot(x) Taylor Polynomial Function
f = @(x)cot(x); a = 5*pi/8; P0 = @(x)f(a)*ones(size(x)); P1 = @(x)f(a)+(- f(a).^2 - 1).*(x-a); P2 = @(x) f(a)+(- f(a).^2 -...

1 jour ago | 0

Integro-differential systems
Solve d(psi)/dt = x(t), psi(0)=0 dx/dt = psi(t) - x(t), x(0) = ? Best wishes Torsten.

1 jour ago | 1

PDEPE boundary condition outputting odd results.
function main m = 0; tspan = linspace(0,365*20*86400,21); xmesh = linspace(0,20,201); sol = pdepe(m,@pdefun,@icfun,...

4 jours ago | 0

| accepted

---- ------- ---- ------
format long I = 0.0; Iexact = 0.904524237900272; eps = 1e-15; n = 0; while abs(I-Iexact) > eps I = I + (-1)^n/(factorial(...

4 jours ago | 0

| accepted

Generate random number from a two-parameter exponential distribution
gam = ...; lambda = ...; n = 100; x = gam - log(1-rand(n,1))/lambda give you 100 random numbers distributed according to you...

5 jours ago | 0

| accepted

how to run optimisation problem
Use fmincon with objective function f = @(x)(R'*x)/sqrt(x'*sigma*x) and linear constraint Aeq = ones(size(x)) beq = 1 Best...

5 jours ago | 0

How to take the fourth derivative of a reflectance graph
If you have the signal processing toolbox licenced, use "sgolay" and "sgolayfilt". Or download from the file exchange: https:/...

5 jours ago | 0

| accepted

Saving all the variables from an ode45 Function
[tw1,yw1] = ode45('Newscript_VectorField',Timet1,Ic1,options) w = yw(:,1)*Yi11 + yw(:,2)*Yi12

6 jours ago | 1

How to automatically constrain some of the unknown values in an optimization problem?
If you know in advance which elements of the x-vector are grouped together, you can simply use Aeq and beq to define the equalit...

6 jours ago | 1

| accepted

Too many input arguments - Fminsearch
function fmin x0=0; %parâmetro de valor inicial para a condição options=optimset('Display','iter','TolFun',0.1) [x]=fmi...

7 jours ago | 0

Error in while loop
Do you want a different value for B for each minor, i.e. B(i) instead of B ? Then use function IsStable(polynomial) if AllNon...

7 jours ago | 1

| accepted

Combining vectors [1 2 3 4 5] and [2 3 4 1 5] to [12 23 34 41 55]
v = 10*v1 + v2

7 jours ago | 0

| accepted

Set up an OR argument for equation
v = (xdot_1-xdot_2)).*(sign(x1-x2-gap)+1)/2; if v > 0 fp = (k_inp*(x1-x2-gap)+c_inp*(xdot_1-xdot_2)).*(sign(x1-x2-gap)+1)/2 ...

8 jours ago | 1

| accepted

distance between two points
You mean "where each row indicates the XYZ coordinates of a point" ? And you want to calculate the distance between the correspo...

11 jours ago | 1

Correct formulation for a fmincon problem
The vector of unknowns for fmincon will be Uvec = [u1(t0),u2(t0),u3(t0),u4(t0),u5(t0),u1(t2),u2(t2),u3(t2),u4(t2),u5(t2),...,u1...

11 jours ago | 0

ode45 code not running and need help imputing my boundary conditions
function main y0=zeros(7,1); y0(1) = 0; % f y0(2) = 0; % f' y0(3) = 0; % f'' y0(4) = 0; % theta y0(5) = 0; % theta' ...

11 jours ago | 1

| accepted

How to generate random orthogonal codes in matlab
mat2str(de2bi(randi([0,3],5,16)))

12 jours ago | 0

| accepted

plotting profiles from differential equations
function dFTdV = Reactor3(V,FT) %Reactor3 function is used to obtain mass and energy balances across the %reactor F = FT(1...

12 jours ago | 1

How to calculate the distance
distmat = B(:,4:7)-repmat(A,4,1); dist = vecnorm(distmat.')

13 jours ago | 1

| accepted

trouble in integral solving [SOLVED]
q = vpa ( int(fun,[-Inf Inf]) )

13 jours ago | 0

splitting real and imaginary part of a complex equation in order to generate two nonlinear equations to solve for two unknown real constants
Z0 = 50; Y0 = 1/Z0; e_inf = 4.6; % optical permittivity at high frequencies e_s = 78.3; % static permittivity ...

13 jours ago | 0

"The boundary condition function BCFUN should return a column vector of length..." ERROR USING BVP4C
As initial condition, you give a row vector of ones of length 432. So in ex1ode, bvp4c will give you a vector of length 432 for...

13 jours ago | 1

Finite Integral with periodic values of x
idx = (x>=0.3 & x<=4.5); xp = x(idx); yp = y(idx); F = cumtrapz(xp,yp); F = F(end) - F; plot(xp,F)

14 jours ago | 1

| accepted

Integration within particular range
idx = x>=2 && x<=3; xp = x(idx); yp = y(idx); value = trapz(xp,yp)

14 jours ago | 0

| accepted