Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to solve the following matlab problem?
조회 수: 2 (최근 30일)
이전 댓글 표시
This is the code in which I am working on right now.
% b = 10000; % frequency
a = 0.5; %amplitude
c=440*1.0595^(3);
for j = 1:7;
for i= 1:24;
A(i,j)= a*cos(b*i)+c; %c is used for make an offset
end;
surf(A);
Now, The goal is to adjust the line A(i,j)=cos(i) so that the plot shows about 50 cosine curves in the middle of the day, and about 5 curves in the middle of the night. Here, total of 24 rows, first row is 12 o'clock, middle of the day. I have to play with values for these 3 constants (b, a and c) until my plot is correct (or fit with the above description). I have tried a lot by changing the value but I failed. Please help me. And ask me for update if my question is not clear to you. Thank you.
댓글 수: 0
답변 (1개)
Image Analyst
2014년 5월 18일
Is this your homework? You're going to need 3 single for loops, one for each part of the day, not two nested for loops.
t = 1 : 50
for h = 1 : 8
A(h,:) = ...some function of t.......
end
for h = 9 : 16
A(h,:) = ...
end
for h = 17 : 24
A(h,:) = ...
end
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!