Implementation of a matrix

조회 수: 1 (최근 30일)
Franzi
Franzi 2020년 6월 16일
댓글: Rena Berman 2020년 10월 12일
Hello!
I want to implement a function, which has n as an input an outputs the following matrix:
Can someone help me please?
  댓글 수: 2
madhan ravi
madhan ravi 2020년 6월 18일
Huh... why waste others time by asking a question if it’s going to be deleted anyway??
Rena Berman
Rena Berman 2020년 10월 12일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2020년 6월 16일
You haven't told us what x and e are, but assuming x is a vector and e is a scalar, simply this:
result = cos( (1:n) .* x(:) * e )
  댓글 수: 1
Steven Lord
Steven Lord 2020년 6월 16일
What is the value of n?
What are the sizes of each of a, x, and y?
What do you mean by "whats[sic] wrong"?
  • Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
  • Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
  • Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support using the telephone icon in the upper-right corner of this page so we can investigate.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Vishal Gaur
Vishal Gaur 2020년 6월 16일
Code to generate the mentioned output is:
for i=x
for j=1:n
matCos(i,j) = cos(j*x(i)*exp(1));
end
end

David Hill
David Hill 2020년 6월 16일
If x and e are symbolic
syms x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 e;
x=[x1 x2 x3 x4 x5 x6 x7 x8 x9 x10];
for k=1:n
y(k,:)=cos((1:n)*k*x(k)*e);
end

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by