How to solve the following matlab problem?

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.

Réponses (1)

Image Analyst
Image Analyst le 18 Mai 2014
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

Cette question est clôturée.

Tags

Aucun tag saisi pour le moment.

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by