Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to solve the following matlab problem?
1 次查看(过去 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!