Use suitable MATLAB commands to distribute random temperatures (from 0 0C to 5 0C) for a room (10?∗7?), considering the walls’ temperature as given in the figure. Plot the temperature vs. distance using the command surf. In addition to having a suitable title, the vertical and horizontal axes of your graph should be properly labeled

댓글 수: 3

darova
darova 2020년 3월 25일
What is the purpose of using code button for plain text? Can't you write normally?
I can't read this
Adam Danz
Adam Danz 2020년 3월 25일
This sounds like homework.
Can you show us how far you are into solving this and explain where you're stuck?
I solve it like this , but Im not sure
What do you think?
>> dim=[1 1 1 1 1 1 1];
>> temp=[dim;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;1 randi([0 5],1,5) 1;dim];
>> surf(temp)
>> xlabel('width(c)')
>> ylabel('length(R)')
>> zlabel('Temprature')
>> title('The Distribution Of Room Temprature')

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

 채택된 답변

Adam Danz
Adam Danz 2020년 3월 25일
편집: Adam Danz 2020년 3월 25일

1 개 추천

The question mentions "random temperatures" between 0 and 5. Your random values are all integers but random temperatures would contain fractions of degrees as well (ie, 4.1973).
To create random values between 0 and 5,
randTemp = rand(8,5) * 5;
Also, use axis equal so that the aspect ratio is the same between the x and y axes.
You may also want to consider using view(2) after creating the surf plot.

댓글 수: 2

Rawand Mazen
Rawand Mazen 2020년 3월 25일
thank you
Adam Danz
Adam Danz 2020년 3월 25일
Glad I could help.
Feel free to ask follow-up questions if you run into any problems.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2020년 3월 25일

댓글:

2020년 3월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by