Info

This question is closed. Reopen it to edit or answer.

if I were to do a=[1,2,3,4....1000] and b=[1,2,3] and c=[4,5,6] how can i put them in as values of (b1, c1)(b2, c2) and test that through for every value within a? ex. (a*5)+(a*(​BVALUE))/(​CVALUE)

1 view (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. how can i do this? Here is 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))
and that gives me a "matrix dimensions must agree" error. help

Answers (1)

Matt J
Matt J on 5 Feb 2018
a=a(:);
b=b(:).';
c=c(:).';
results=a.*(5+b./c)

Community Treasure Hunt

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

Start Hunting!