Array with complex expression

  • Thread starter gfd43tg
  • Start date
  • #1
gfd43tg
Gold Member
953
49

Homework Statement


I am working on problem 4 in the PDF attachment now, but I will show my code for 2 and 3 since they are related to 4. The values for 2 and 3 were given in the editor.

Homework Equations





The Attempt at a Solution



2.
Code:
P = [1.6, 4, 2.9, -8];
N = 3;
PextDown = repmat(P,3,1);
EDU>> PextDown

PextDown =

    1.6000    4.0000    2.9000   -8.0000
    1.6000    4.0000    2.9000   -8.0000
    1.6000    4.0000    2.9000   -8.0000

3.
Code:
D = [7.2;-3.1;1.3];
M = 4;
DextAcross = repmat(D,1,4);
EDU>> DextAcross

DextAcross =

    7.2000    7.2000    7.2000    7.2000
   -3.1000   -3.1000   -3.1000   -3.1000
    1.3000    1.3000    1.3000    1.3000

4.
What the heck are they trying to get me to do with this e^(complex stuff) using these arrays?? I don't really even comprehend the question to start this thing. My current thought is that they want something like this
Code:
fDP =(1/(1+DextAcross.^2+PextDown.^2))+exp(-abs(DextAcross)*cos(DextAcross*PextDown));
Error using  / 
Matrix dimensions must agree.
 

Attachments

  • Problem 4.pdf
    26.1 KB · Views: 133
Last edited:

Answers and Replies

  • #2
gfd43tg
Gold Member
953
49
It turns out that you need to put a period (.) before arithmetic operations involving either 2 matrices or a matrix and a scalar.

Code:
fDP = (1./(1+DextAcross.^2+PextDown.^2))+exp(-abs(DextAcross).*cos(DextAcross.*PextDown));

fDP =

    0.0452  506.7186   24.4058    0.0366
    0.5437    0.0846   16.6889    0.0668
    2.0751    0.5974    2.9525    2.0886
 

Related Threads on Array with complex expression

  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
958
Replies
12
Views
3K
Replies
1
Views
571
Replies
3
Views
2K
  • Last Post
Replies
6
Views
6K
  • Last Post
Replies
5
Views
726
Replies
4
Views
2K
  • Last Post
Replies
2
Views
1K
Top