Login

Welcome, Guest. Please login or register.

September 28, 2025, 01:32:06 am

Author Topic: ENG1060 Computing  (Read 44399 times)  Share 

0 Members and 1 Guest are viewing this topic.

moekamo

  • Victorian
  • Forum Obsessive
  • ***
  • Posts: 275
  • Respect: +4
Re: ENG1060 Computing
« Reply #135 on: May 08, 2011, 07:21:36 pm »
0
yep
2nd Year BSc/BEng @ Monash

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #136 on: May 08, 2011, 08:14:51 pm »
0
For Q1c of the assignment, how are we meant to manually find the location of the corner? does it have to be exact?

RainerWolfram

  • Victorian
  • Forum Obsessive
  • ***
  • Posts: 346
  • X&Y
  • Respect: +14
Re: ENG1060 Computing
« Reply #137 on: May 08, 2011, 08:39:39 pm »
0
For Q1c of the assignment, how are we meant to manually find the location of the corner? does it have to be exact?

I used the data cursor tool and clicked it on the dot in the corner.
I got x ~= -0.4984. I'm not too sure if I'm using the right corner

« Last Edit: May 15, 2011, 12:33:21 am by danieltennis »
2010: B.Eng(Mechatronics)/B.Science(Computer Science/Astrophysics), Monash University
2011 Sem1: B.Eng(Electrical & Computer Systems)/B.Science(Computer Science), Monash University
2011 Sem2: B.Commerce (Finance + Software Systems), University of Melbourne

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #138 on: May 08, 2011, 09:13:09 pm »
0
Also are we meant to use the polyfit/polval function twice since we're fitting two lines?

RainerWolfram

  • Victorian
  • Forum Obsessive
  • ***
  • Posts: 346
  • X&Y
  • Respect: +14
Re: ENG1060 Computing
« Reply #139 on: May 08, 2011, 09:28:20 pm »
0
Also are we meant to use the polyfit/polval function twice since we're fitting two lines?

Yep, it was like the last question from last week's lab where you had to do it three times for three parts of graph. We're only fitting two linear lines for this one though
2010: B.Eng(Mechatronics)/B.Science(Computer Science/Astrophysics), Monash University
2011 Sem1: B.Eng(Electrical & Computer Systems)/B.Science(Computer Science), Monash University
2011 Sem2: B.Commerce (Finance + Software Systems), University of Melbourne

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #140 on: May 08, 2011, 09:35:41 pm »
0
Ahh yep cheers man. I'm a bit unsure as to what I'd use as my independant and dependant data for each of the two lines.

Would it be x = 1:640 , y = avg_x for line 1
x = 1:640, y = avg_z for line 2

RainerWolfram

  • Victorian
  • Forum Obsessive
  • ***
  • Posts: 346
  • X&Y
  • Respect: +14
Re: ENG1060 Computing
« Reply #141 on: May 08, 2011, 10:55:28 pm »
0
Ahh yep cheers man. I'm a bit unsure as to what I'd use as my independant and dependant data for each of the two lines.

Would it be x = 1:640 , y = avg_x for line 1
x = 1:640, y = avg_z for line 2


You have to pick a suitable range for the values of avg_x.
For the left wall, I let avg_x1 = avg_x(leftIndices) where leftIndices = 1:533
For the right wall, I let avg_x2 = avg_x(rightIndices) where rightIndices = 533:end

I did the same thing for avg_z1 and avg_z2

You then have to find the polyfit for each of these two cases.

After, you can find the polyval directly in the plot() function
e.g
plot(avg_x, avg_z, 'k.', avg_x, polyval(p1, avg_x), 'r-', .....
« Last Edit: May 15, 2011, 12:58:54 am by danieltennis »
2010: B.Eng(Mechatronics)/B.Science(Computer Science/Astrophysics), Monash University
2011 Sem1: B.Eng(Electrical & Computer Systems)/B.Science(Computer Science), Monash University
2011 Sem2: B.Commerce (Finance + Software Systems), University of Melbourne

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #142 on: May 09, 2011, 12:33:06 am »
0
The wording of lab7 Q2 is confusing. What are the inputs and outputs meant to be for my function file?

JinXi

  • Victorian
  • Forum Leader
  • ****
  • Posts: 818
  • Respect: +90
  • School: Camberwell High School
  • School Grad Year: 2010
Re: ENG1060 Computing
« Reply #143 on: May 09, 2011, 04:39:12 pm »
0
For Q1c of the assignment, how are we meant to manually find the location of the corner? does it have to be exact?

I used the data cursor tool and clicked it on the dot in the corner.
I got x ~= -0.4984. I'm not too sure if I'm using the right corner


I used the other corner towards the end. seems more logical to me.
Monash B.Aero Eng/Sci Discontinued in Sem2 2012 [2011-2015]

"I will always choose a lazy person to do a difficult job… because, he will find an easy way to do it." ~ Bill Gates
^ SNORLAX, I chooosee You!!!

JinXi

  • Victorian
  • Forum Leader
  • ****
  • Posts: 818
  • Respect: +90
  • School: Camberwell High School
  • School Grad Year: 2010
Re: ENG1060 Computing
« Reply #144 on: May 09, 2011, 07:56:18 pm »
0
lol... I tried to troll Wai Ho but got countered trolled at... by him :-\ (In the exams disccusion where he replied....)
Monash B.Aero Eng/Sci Discontinued in Sem2 2012 [2011-2015]

"I will always choose a lazy person to do a difficult job… because, he will find an easy way to do it." ~ Bill Gates
^ SNORLAX, I chooosee You!!!

taiga

  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 4085
  • Respect: +588
Re: ENG1060 Computing
« Reply #145 on: May 09, 2011, 10:45:51 pm »
0
lol... I tried to troll Wai Ho but got countered trolled at... by him :-\ (In the exams disccusion where he replied....)

ahaha that's hilarious
vce: english, methods, spesh, chemistry, physics, geography.

ex admin/mod/partner

2010: Melbourne High School (VCE)
2011 - 2016: Monash University BComm/BEng (Hons)


If you guys have any concerns/suggestions for making ATARNotes a better place, don't hesitate to PM me.

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #146 on: May 10, 2011, 10:53:09 pm »
0
Need help with lab 7 Q3:

I know that you need to implement a while loop there somehow but not quite sure:

This is what I have so far:

% Function inputs
a = -1.5;
b = 1.5;
func = @(x) 4*x.^3*3.*exp(x).*cos(x);

% Ask user for rule and segments
rule = input('Enter 1 to use composite trapezoidal or 2 for composite simpson 1/3:');
n = input('Enter number of segments:');

if rule ==  1
    I = comtrapz(func,a,b,n);
elseif rule == 2
    I = compsimpson1_3(func,a,b,n);
end

JinXi

  • Victorian
  • Forum Leader
  • ****
  • Posts: 818
  • Respect: +90
  • School: Camberwell High School
  • School Grad Year: 2010
Re: ENG1060 Computing
« Reply #147 on: May 10, 2011, 11:01:45 pm »
0
Need help with lab 7 Q3:

I know that you need to implement a while loop there somehow but not quite sure:

This is what I have so far:

% Function inputs
a = -1.5;
b = 1.5;
func = @(x) 4*x.^3*3.*exp(x).*cos(x);

% Ask user for rule and segments
rule = input('Enter 1 to use composite trapezoidal or 2 for composite simpson 1/3:');
n = input('Enter number of segments:');

if rule ==  1
    I = comtrapz(func,a,b,n);
elseif rule == 2
    I = compsimpson1_3(func,a,b,n);
end

You can't ask the user to input n value before deciding which rule to take. It's cause the simpson's 1/3 method only works with even number of segments whereas the composite trapezoid rule works with 2 or more segments.

So your code should had split into two components using the if loops right after the user inputs which rule to chose.

You will also need a nested loop in your simpson's 1/3 loop for the n segments where if the user decides to input an odd value it'll ask for another value.

Finally,(not sure you're up to this yet), you nid a while loop covering all your loops to repeat the program over and over again to calculate different Integral estimates using different rules/segments.

Hope this helps =)
Monash B.Aero Eng/Sci Discontinued in Sem2 2012 [2011-2015]

"I will always choose a lazy person to do a difficult job… because, he will find an easy way to do it." ~ Bill Gates
^ SNORLAX, I chooosee You!!!

sajib_mostofa

  • Victorian
  • Forum Leader
  • ****
  • Posts: 829
  • Respect: +6
Re: ENG1060 Computing
« Reply #148 on: May 10, 2011, 11:08:47 pm »
0
Cheers for that man. If I don't ask the user for the number of segments after the rule, then where should I ask them? Also was the m-file for this Q lengthy?

"You can't ask the user to input n value before deciding which rule to take. I've done that afterwards though, havent I?
« Last Edit: May 10, 2011, 11:11:35 pm by sajib_mostofa »

JinXi

  • Victorian
  • Forum Leader
  • ****
  • Posts: 818
  • Respect: +90
  • School: Camberwell High School
  • School Grad Year: 2010
Re: ENG1060 Computing
« Reply #149 on: May 10, 2011, 11:13:58 pm »
0
Cheers for that man. If I don't ask the user for the number of segments after the rule, then where should I ask them? Also was the m-file for this Q lengthy?

Just ask for the value of n after the rule had been chosen.

Eg if rule == 1
          n = input('.......')
          I = comtrapz(func,a,b,n);
    elseif rule == 2
          n = input('....')
             if
                 *Nested Loop here in case the user enters an odd number of segments
             end
          I = compsimpson1_3(func,a,b,n);
    end
And my M-File was about 50 lines with quite detailed comments. Probably 3x lines of pure code.
Monash B.Aero Eng/Sci Discontinued in Sem2 2012 [2011-2015]

"I will always choose a lazy person to do a difficult job… because, he will find an easy way to do it." ~ Bill Gates
^ SNORLAX, I chooosee You!!!