Small Help in MatLap ( square matrix ? )

  • Thread starter Thread starter ahmedking
  • Start date Start date
  • Tags Tags
    Matrix Square
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
ahmedking
Messages
2
Reaction score
0
Small Help in MatLap ( square matrix ?!? )

>> n=-5:0.01:17;
>> u=1;
>> x=0.7^n*u(n);
? Error using ==> mpower
Matrix must be square.

how can i solve this problem

as iam a beginner in the matlap :)the main question is

plot the following discrete functions

1- x[n]=0.7^n*u[n] -5<n<17

please help me thanks in advance
 
Physics news on Phys.org


please help i need it urgently :)
 
ahmedking said:
how can i solve this problem

as iam a beginner in the matlap :)
I'm pretty sure you mean matlab.
ahmedking said:
>> n=-5:0.01:17;
>> u=1;
>> x=0.7^n*u(n);
? Error using ==> mpower
Matrix must be square.
Your variable n is an array, so you need to use the element-by-element power operator, which is .^

Also, you are setting u to 1 in the second line, above, but u appears to be an array in the third line. You're going to run into another problem with u(n), since the index of an array has to be an integer >= 1. IOW, the value of n must be an integer >= 1 in an expression u(n).

Here's a link to some documentation on MATLAB. I have found it to be pretty helpful.
http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/getstart.pdf
ahmedking said:
the main question is

plot the following discrete functions

1- x[n]=0.7^n*u[n] -5<n<17

please help me thanks in advance