Matlab: creating a table of equations using multiple variables

  • Thread starter Samefiddle
  • Start date
  • #1

Homework Statement


I have an equation that looks like func=sin(pi*x*n)*sin(pi*y*m) I was wondering if there was any method (possibly involving for loops) where I could get a plottable function along xy for all the different combinations of n and m
i.e. m= 1 n =1
so the function would be
sin(pi*x*1)*sin(pi*y*1)
then m=1 n=2
sin(pi*x*1)*sin(pi*y*2)
and so on...
so basically it would create m*n equations


Homework Equations





The Attempt at a Solution


i tried something like
x=1:10;
y=1:10;
n=1:10;
m=1;10;
for i=1:length(x)
for ii=1:length(n)
for iii=1:length(y)
for iiii=1:length(m)
QQ(i)=sin(pi*x(i)*n(ii))*sin(pi*y(iii)*m(iiii))
end
end
end
end

but this i assume yields 10 values which correspond to when x y n m all equal the same values on the for loops. i.e. the first value is when x,y,n,m = 1 and the second value is when x,y,n,m = 2 etc.
 

Answers and Replies

Related Threads on Matlab: creating a table of equations using multiple variables

  • Last Post
Replies
9
Views
3K
Replies
6
Views
7K
Replies
0
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
11K
  • Last Post
Replies
9
Views
7K
Replies
4
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
2
Views
2K
Top