f



Really need help in this MATLAB problem.

Going to go crazy. I noob in matlab. Please help me in those problem.

Q : 

Write MatLab solution for the function DF that asks for a teamperature(in degree fahrenheit) and computes the equivalent temperature in degrees Celcius, and another function DC that asks for a temperature(in degrees Celcius) and computes the equivalent teamperature in degree Fahrenheit. Your functions should be able to accept both scalar and matrix input.

The script should keep running until o number is provided to convert.

[The function isempty will be useful here.]

(Hint : Fahrenheit to Celsius : (F-32)*5/9
Celsius to Fahrenheit : (C*9/5 + 32))


Q : 

Create a vector x with elements,

Xn = (-1)^n+1 / (2n-1)

Add up the elements of the version of this vector that has 100 elements.



Q : 

Create the vector x = randperm(35) and then evalute the following function using oly logical indexing : 

y(x) = 2        if x < 6
     = x - 4    if 6 <= x < 20
     = 36 - x   if 20 <= x <= 35




Really hope someone is kind enough to help me slove the prob. :(
0
kyamato
8/29/2010 4:11:26 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
836 Views

Similar Articles

[PageSpeed] 5

kyamato <jayzoner@gmail.com> wrote in message <1737293872.109429.1283069516649.JavaMail.root@gallium.mathforum.org>...
> Going to go crazy. I noob in matlab. Please help me in those problem.
> 
> Q : 
> 
> Write MatLab solution for the function DF that asks for a teamperature(in degree fahrenheit) and computes the equivalent temperature in degrees Celcius, and another function DC that asks for a temperature(in degrees Celcius) and computes the equivalent teamperature in degree Fahrenheit. Your functions should be able to accept both scalar and matrix input.
> 
> The script should keep running until o number is provided to convert.
> 
> [The function isempty will be useful here.]
> 
> (Hint : Fahrenheit to Celsius : (F-32)*5/9
> Celsius to Fahrenheit : (C*9/5 + 32))
> 
> 
> Q : 
> 
> Create a vector x with elements,
> 
> Xn = (-1)^n+1 / (2n-1)
> 
> Add up the elements of the version of this vector that has 100 elements.
> 
> 
> 
> Q : 
> 
> Create the vector x = randperm(35) and then evalute the following function using oly logical indexing : 
> 
> y(x) = 2        if x < 6
>      = x - 4    if 6 <= x < 20
>      = 36 - x   if 20 <= x <= 35
> 
> 
> 
> 
> Really hope someone is kind enough to help me slove the prob. :(

Hi 

This group does not generally operate as a homework service, but we are happy to help with Matlab questions.

To get help here, you could write some code, try it out, try to fix the problems you run into, and then ask questions here if you get stuck.

Have you read "Getting Started"? http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/bqr_2pl.html

For your homework, you will use material from Matrices and Arrays, and Programming.

Ross
0
Ross
8/29/2010 10:53:03 AM
For #1 you just need to read up on making a function.  The assignment
was about as simple as you could get.  The isempty is wanted so that
you can throw up an error in case the user calls the function with no
arguments.

Hint for #2:
Look up the colon (:) operator to create a vector for n.  Then look up
the difference between ./ and /, and .^ and ^.  The dot is important!
You will need that.  To sum up the array, construct a for loop
(standard "noob" way to do it), or use the bult in function called
"sum()" - be sure NOT to use any variable in your code called sum or
you will override the built in sum function (a very common "noob"
error).

For #3 the hint is look up "masking" in the help and go to the 4th
entry -- the one that says "Using logicals in array indexing."  Hint:
you're going to need logical indexing on BOTH the x and y arrays.
That should get you started.  Good luck.
0
imageanalyst (7621)
8/29/2010 1:52:15 PM
Reply: