Results 1 to 8 of 8

Math Help - Matlab help with a special problem

  1. #1
    Newbie
    Joined
    Nov 2009
    Posts
    5

    Post please help me

    Hello guys:
    I have a problem to solve this problem. plz help me. I am novice in matlab so please tell me what can I do? Don't become confused, I've made the problem easy to understand. You don't need to know physics

    You are an engineer working for a company that has to supply computer equipment for use on a large turbo-prop aircraft. The equipment has a mass of 40kg. You have been asked to provide antivibration mounts such that the response of the equipment to environmental disturbances transmitted through the support structure will satisfy the limits prescribed by the customer.

    So basically it means that mass m=40kg is vibrating vertically on a vibrated base.



    Condition: P < 1.25 from 0-15 Hz and P< 0.30 from 15-40 Hz.(call the frequency f)
    I want to choose 4 mounts in parallel since I think thats stable enough so let n=4

    I've given all the formule requred below:
    mass=40kg
    wn=sqrt(4*k/m) wn : natural frequency of the system
    zita=1/(2*m*wn)*(4*c) zita:damping ratio
    r=w/wn w: forced frequency
    P=r^2/sqrt(1*(1-r^2)^2+(2*zita*r)^2)

    The formula for w=2*pi*f

    How can I write this program to find the cheapest combination with 4 mounts which satisfies the above condition
    Last edited by supernova1387; November 13th 2009 at 03:08 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Does the mount stiffness code "A" correspond to the mount damning code "1" or are they independent of each other.

    EDIT: They are obviously independant of each other since their are 6 mounts and 7 mount dampeners. This looks like a binary optimization problem. The objective function will be the cost of the system and everything else will need to be considered in the constraints I think. I haven't tried a problem like this yet in MATLAB but "bintprog" would be the first function I looked at. Just not sure how it will handle the constraints tho?

    Elbarto
    Last edited by elbarto; November 7th 2009 at 03:12 PM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Nov 2009
    Posts
    5

    re

    Dear elberto:
    We can choose any combinaions like C4, A5 and ... . But once we choose 1 code like A5 then all mounts shoud be identical.
    We have just done some basic matlab like for loops and... . I don't think it's that much difficult. Could you plz give me more clue? If you need more info, please let me know.

    Quote Originally Posted by elbarto View Post
    Does the mount stiffness code "A" correspond to the mount damning code "1" or are they independent of each other.

    EDIT: They are obviously independant of each other since their are 6 mounts and 7 mount dampeners. This looks like a binary optimization problem. The objective function will be the cost of the system and everything else will need to be considered in the constraints I think. I haven't tried a problem like this yet in MATLAB but "bintprog" would be the first function I looked at. Just not sure how it will handle the constraints tho?

    Elbarto
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Not sure exactly on the problem how to deal with the frequency but I would look at making a cost matrix and a condition matrix P to evaluate what the possible choices are.

    Here is some rough code that you might be able to chop up a bit to make work for you.

    Code:
    n = 4;%number of mounts
    
                   %rows = $mount              cols = $dampner
    cost = n*(repmat([25 30 35 45 50]',1,6) + repmat([0 5 10 15 30 50],5,1))
    %ie 2nd row 3rd column is combination B3
    
    %do similar for k and c
    
    k = n*(repmat([25 30 35 45 50]',1,6));
    c = n*repmat([0 5 10 15 30 50],5,1);
    
    f = 15;%is the frequency fixed?????????????
    
    m=40;
    wn=(4*k./m).^0.5 ;
    zita=1./(2.*m.*wn).*(4.*c);
    w = 2*pi*f;
    r=w./wn;
    P=real(r.^2./sqrt(1.*(1-r.^2)+(2.*zita.*r).^2))
    Once you sort that part out, its just a mater of a few more lines of code to pick the cheapest viable option.

    Elbarto
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Nov 2009
    Posts
    5

    Please answer it before my classmates find my code on the web

    1
    Last edited by supernova1387; November 14th 2009 at 02:36 PM.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    I would stick with the vectorized code where possible, makes thing easier at times and looks like this would be a good example. I would test the first condition and second condition just like what you have done, but instead find a logical array (ie 1 if true) of combinations that satisfy the conditions. One you find 2 arrays (ie since you have 2 different conditions), you can just test which index is true in both arrays and this will be a viable options. You can then just focus on these values and pick the one with the lowest cost. Below demonstrates how to find a logical array for the first frequency condition. Code is a bit sloppy but should give you my general idea.

    Code:
    clc;clear;
    n=input( 'Enter number of mounts: ') ; %number of mounts
    a=repmat([0 5 10 15 20 30 50],6,1); % array consist of price of damperes
    b=repmat([25 30 35 40 45 50],7,1);
    d=b'; %array consist of price of springs
    format compact
    
    
    K=repmat([2500 5000 10000 20000 40000 80000],7,1);
    k=K'; % array consist of stiffness of springs
    c=repmat([50 100 150 250 400 500 1000],6,1); %array consist of dampings
    m=40; % mass of the motor in kg
    
    p=0;
    f1 = 0:15;
    p1 = zeros([size(k) length(f1)]);
    for i=1:length(f1);
        f = f1(i);%
        w=2*pi*f;
        wn=sqrt(n.*k./m);
        zita=n.*c./(2.*m.*wn);
        r=w./wn;
        p=r.^2./sqrt((1-r.^2).^2+(2.*zita.*r).^2);
        p1(:,:,i) = p;%put matrix in 3d array p1
    end
    
    %process results into true or false.
    %sorry for the loops, not sure how to vectorize 3d arrays
    p1_logical_matrix = zeros(size(k));
    for i =1:size(p1,1);
        for j = 1:size(p1,2);
            tmp = squeeze(p1(i,j,:) <= 1.25);
            if any(tmp == 0);
                continue
            else
                p1_logical_matrix(i,j) = 1;
            end
        end
    end
    disp('Combinations meeting requirements for 0<f<15')
    disp(p1_logical_matrix)
    I have tried to get rid of any "magic numbers" in the code so you can easily adapt it to the second case.

    Elbarto
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Nov 2009
    Posts
    5
    Dear Elbarto:
    I looked at your code but we really haven't done that much advanced matlab and I am sure that the teacher is looking for simple things. I really don't understand what some commands which you have written mean but thanks for your help.
    I tried again making everything in one loop but apparently its not working
    my idea is simple.Plz look at my code and tell me where am I going wrong. I don't want to use matrix because when I use matrix it gives me error for function p and I think its because we are dividing a matrix by another one and thats not gonna work.

    n=input( 'Enter number of mounts: ') ; %number of mounts
    a=repmat([0 5 10 15 20 30 50],6,1); % array consist of price of damperes
    b=repmat([25 30 35 40 45 50],7,1);
    d=b'; %array consist of price of springs
    format compact

    c=repmat([50 100 150 250 400 500 1000],6,1);
    K=repmat([2500 5000 10000 20000 40000 80000],7,1);
    k=K'; % array consist of stiffness of springs


    m=40; % mass of the motor in kg


    for i=1:42


    w1=2*pi*f(1:15);
    w2=2*pi*f(16:40);
    wn=sqrt(n*k(i)/m);
    zita=n*c(i)/(2*m*wn);
    r1=w1/wn;
    r2=w2/wn;
    p1=r1^2/sqrt((1-r1^2)^2+(2*zita*r1)^2);
    p2=r2^2/sqrt((1-r2^2)^2+(2*zita*r2)^2);
    if p1<=1.25 && p2<=0.3;
    cost=n*(a(i)+d(i));
    y=[cost c(i) k(i)];
    disp(y)

    end
    end
    format

    I dont want to make matrices for f1 or f2 and I think what I have written for f1 and f2 are matrice and thats why its not working. Do you know how can I make it correct?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Yes the problem is that you are indexing f before you even define what f is. If you want to use loops, some sudo code might look like this:

    Code:
    for each mount:
        flag = 1 % assume combo is ok
        for f = 1:40
            if p not ok:
                flag combo as 0 and break to main loop
            else:
                continue with this loop
    I haven't implemented this so do not know how it will go. If you like you can post up what operations you have trouble with and I can try point you in the right direction. The first program I ever wrote in matlab had about a million variables in it because I did not understand the concept of vectorized code. After picking up some of the basics, it makes problems such as this so much simpler to construct by avoiding loops so if you get a chance you should have a look into it some more as it is one of the things that make matlab an attractive language to use for engineering applications.

    Regards Elbarto

    Edit:
    Is it possible to calculate f based on the 2 "p" values of interest? ie check that f @ (p=1.25) is within 0-15Hz etc. This would eliminate the need for 1 loop.
    Last edited by elbarto; November 14th 2009 at 05:07 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Help with Special Triangle Problem
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: May 27th 2010, 04:03 AM
  2. Special Triangle Problem
    Posted in the Geometry Forum
    Replies: 1
    Last Post: May 22nd 2010, 05:49 AM
  3. Help me with my special problem
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: February 17th 2010, 12:31 PM
  4. Linear Algebra Special Matrices Problem!
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: September 2nd 2008, 03:21 AM
  5. Help with a special right triangles problem
    Posted in the Geometry Forum
    Replies: 1
    Last Post: April 22nd 2007, 11:47 AM

Search Tags


/mathhelpforum @mathhelpforum