How do I multiply 2 different sized arrays together?

Currently I have 2 variables stored in an array: one variable(f) contains the frequency which contains about 1000+ points and a variable(wl) that contains only about 10 values
How do I use both variables in a single equation such as Jdz = wl.*thInG.*(Int.*part1.*(part2 - part3))./Eg; where the Int variable depends on the f variable.
Currently, I am facing the Dimension Don't match error.

4 Comments

The question is, which values of f are to be matched with which values of wl in computing Jdz? How many Jdz values do you wish to obtain? These are questions you very much need to answer before anyone can help you. The ".*" operation you have used requires a one-to-one matching, which obviously does not hold in your case.
Hello Roger,
I am currently trying to use a list of values that are under the variable wl. But at the same time, I am also trying to use f variable which is an array of value with over a thousand points.
There should be only 10 Jdz values, one produced from every wl variable.
You haven't yet explained how the 1000+ values in f are to be used to produce only 10 Jdz values. You could separate the f values into ten distinct groups but how would you deal with the hundred or so elements in each group, along with a single value of wl, to produce a single numerical value in Jdz? That is still a question that needs to be answered.
Note: User is using MATLAB 6.1

Sign in to comment.

Answers (1)

x=rand(4);
y=rand(6);
[x,y]=meshgrid(x,y);
z=x.*y

1 Comment

If this is applied with your original numbers you would get 10*1000 Jdz values, not 10.

Sign in to comment.

Categories

Asked:

on 22 Dec 2017

Commented:

on 23 Dec 2017

Community Treasure Hunt

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

Start Hunting!