Info

This question is closed. Reopen it to edit or answer.

How to solve the following matlab problem?

2 views (last 30 days)
Jabir Al Fatah
Jabir Al Fatah on 18 May 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
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.

Answers (1)

Image Analyst
Image Analyst on 18 May 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

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!