Clear Filters
Clear Filters

how can i have a specific set of values run through an equation?

3 views (last 30 days)
i am trying to run specific values (b1,c1)(b2,c2) and so on from b=[1,2,3] c=[4,5,6] through an equation that uses a vector a=[1,2,3,....,1000] and have the equation run through all the data points of (b1,c1)(b2,c2) etc. for each value of a. how can i do this? Here is specifically what I have so far
a=0:.001:1
a0=1-a
u=.1
u0=[5,5,50,90,20]
SD=[.25,.25,.05,.05,1]
SD0=[.25,.25,.25,.5,.2]
p=[.8,-.8,0,.5,.5]
a=a(:);
u0=u0(:).';
SD=SD(:).';
SD0=SD0(:).';
p=p(:).';
SRans=((a.*u)+(a0.*u0))./((((a.^2).*(SD.^2))+((a0.^2).*(SD0.^2))+(2*p.*a.*a0.*SD.*SD0)).^(1/2))
As of right now I'm getting a matrix dimensions error. please help
  3 Comments
Ashley Nelson
Ashley Nelson on 5 Feb 2018
the question isn't 'what is wrong within the equation', the question is, 'is that the correct way to do it or is it wrong'
David Goodmanson
David Goodmanson on 5 Feb 2018
Hi Ashley,
when you say 'run through all the data points' do you mean u0,SD,SD0 would all vary together, ie. u0(1),SD(1),SD0(1),p(1) etc. would be used to make a data point? Or do you want some or all of those to vary independently? Then e.g. u0(1),SD(2),SD0(3),p(2) could be used for a data point and there would be many more data points than in the first case.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!