Skip to main content

All Questions

1 vote
1 answer
74 views

Pass a Previous Value to function MATLAB

I have the following function: y(t) = alpha*y(t-1) + beta*y(t-1) + delta where alpha,beta, and delta are constants. I am assuming that y(0) = 0. I'm trying to create a MATLAB function to represent y(...
Jonathan Frutschy's user avatar
0 votes
2 answers
409 views

Matlab How to iterate a function through a list

I need some help iterating over a function that depends on two variables. So let's say I have a function that depends on two variables. Let's call it f = x + y Now, I have a two lists, one of x ...
Programmer's user avatar
0 votes
1 answer
680 views

MATLAB Error using fzero

y = @(Er) i*sqrt((((w^2*Mr*(Er))/isik_hizi^2)-(2*pi/lamdac)^2)); y0 = i* sqrt((w/isik_hizi)^2-(2*pi/lamdac)^2); yansima = @(Er) ((y0/m0)-(y(Er)/m))/((y0/m0)+(y(Er)/m)); T = @(Er) exp(-y(Er)*l); fx = @(...
Tuna EREN's user avatar
0 votes
3 answers
153 views

How to iterate over functions?

I would like to apply loop over a function. I have the following "mother" code: v = 1; fun = @root; x0 = [0,0] options = optimset('MaxFunEvals',100000,'MaxIter', 10000 ); x = fsolve(fun,x0, options) ...
Beck's user avatar
  • 121
0 votes
1 answer
56 views

Storing iterative function outputs into matrices [duplicate]

I have an iterative function which gives me two vector outputs. How can I store these outputs into two separate matrices in matlab? [A, B]=iterative_function(x,y) the size of A and B varies in every ...
user5916581's user avatar
0 votes
1 answer
71 views

Matlab function argument issue

hey I have a function defined as, drift = @(x1,x2,u)[x2,(a*sin(x1) - b*x2 + u)]*.05; then I attempt to call it while in a triple for loop (iterating over x1= 1:length(n1), x2 = 1:length(n2) x3 = 1:...
user2574476's user avatar
0 votes
0 answers
453 views

Having some trouble changing parameters for ODE113 in MATLAB

I'm working on something much more complicated than I am used to and hoping you all might have some clues. I have a function defined: function dwdt= dyn_hw9_3arigid( t,y ) Ix=3012; %Iy=3012; %...
user2291360's user avatar
19 votes
2 answers
6k views

Iterating over a vector of functions in MATLAB

Is it possible to iterate over a list of functions in MATLAB? I'm trying to test different functions and this seems like the best way to do it.
Dean Barnes's user avatar
  • 2,262
0 votes
1 answer
4k views

Matlab loops for a function

I am trying to make a loop to redo a Matlab function 1000 times. Here's the program d = unifrnd (0,10,[10,1]); c = d.^(-2); a = round(unifrnd(0,1,[1,10]); e = a*c btotal = e+1 SIR = 1/btotal What I ...
Tan Wei Jin's user avatar