Search results

  1. Sirsh

    MATLAB Issues Replicating Simulink Model within MATLAB (2DOF)

    Hey all, I've been trying to debug a model I've created of a 4DOF geared system within Simulink by reproducing the results in MATLAB going from a 2DOF upwards to verify the dynamics are acting correctly. At the moment I am purely trying to model the stiffness between two gears, my equations...
  2. Sirsh

    MATLAB Passing variables out of ODE45

    Sorry, in the mainscript code that I listed I meant to take out the "k_mb = 50;". I have edited it and put it below. Updated mainscript % Mainscript for vibration analysis (19/01/2017). clear all; clc; %% Defining global variables global r_p r_g I_p I_g m_p m_g k_mb r_p = 10; % pinion...
  3. Sirsh

    MATLAB Passing variables out of ODE45

    Hi all, I have the following ode code, and I want to know how I could output the variable "k_mb" within my main script so that I can plot it to see if it's actually active when the solver is integrating. odescript function zdot = odenesttest(t,z) global r_p r_g I_p I_g m_p m_g V k_mb A_or_B =...
  4. Sirsh

    MATLAB MATLAB Repeating Function

    Sorry, I'm still an intermediate at using the ode solvers with matlab. I'll list below what I have written (excluding what you have shown me previously). Main script: % Mainscript for vibration analysis (16/01/2017). clear all; clc; %% Defining global variables global k_mb r_p r_g I_p I_g m_p...
  5. Sirsh

    MATLAB MATLAB Repeating Function

    One easy way to solve this I think is to make a preset array like 'V' extremely long and then change the current angle to z(2).
  6. Sirsh

    MATLAB MATLAB Repeating Function

    Just one more thing (I didn't think it'd be worthwhile beginning a new thread for this when you've responded in here). I'm now trying to incorporate the repeating function into my ODE solving function which obviously requires a bit of modification to the code we have in the previous posts. I'm...
  7. Sirsh

    MATLAB MATLAB Repeating Function

    This is great, works perfectly with the addition of this at the end: if V(current_index) ~= max_angle V(current_index) = []; else V(current_index); end Otherwise the last entry in the V array is either over by 5 or 10. But with that, it works nicely. I'll be sure to check out those...
  8. Sirsh

    MATLAB MATLAB Repeating Function

    Sorry for the confusion, let me explain. The purpose of this is to simulate the revolution of a pair of gears in mesh, so if the user wants to simulate 10 revolutions the angle will be 3600°, if they want to rotate the gears 1 revolution then the angle will be 360°, etc. So the angle is the only...
  9. Sirsh

    MATLAB MATLAB Repeating Function

    Once I start testing the ODE solver, I'll be sure to keep that in mind if it becomes an issue. One further thing, see how the array, V = [0,5,15,20,30,35,45,50,60]; (pre-determined and put in). I want to write something that allows the user to input the angle and then the array is generated...
  10. Sirsh

    MATLAB MATLAB Repeating Function

    The addition of 'last' in the lower_index, fixed the problem instantly. Thus, for: angle = 4 -> a_or_b_for_angle = 5 angle = 6 -> a_or_b_for_angle = 10 angle = 46 -> a_or_b_for_angle = 5 angle = 59 -> a_or_b_for_angle = 10 Thank you very much for your help, I'll use this as my base for my ODE...
  11. Sirsh

    MATLAB MATLAB Repeating Function

    Again, many thanks. I'm quite sure I know what it is trying to achieve. If I run: angle = 4; V = [0,5,15,20,30,35,45,50,60]; A_or_B = [5,10]; lower_index = find(V < angle, 1); even_or_odd = mod(lower_index,2); a_or_b_for_angle = A_or_B(2 - even_or_odd); The values of each vector are...
  12. Sirsh

    MATLAB MATLAB Repeating Function

    Maybe it'll be more clear if I explain the application. I am trying to make a function that allows me to apply a torsional stiffness for gear teeth in mesh, as the gear rotates the gear (in this case) will be in either singular contact or double contact. Where I'm assigning 5° for single and 10°...
  13. Sirsh

    MATLAB MATLAB Repeating Function

    Do you mean for each interval there would be an if statement associated with it? This is the nature of the application that I require for an example of 60°: https://postimg.org/image/xcz38o687/ See how the function needs to be able to periodically apply the values dependent on the total angle...
  14. Sirsh

    MATLAB MATLAB Repeating Function

    Hey all, I need your help writing the meat of a function that I need for a MATLAB script I'm writing. The jist of it is, starting from 0°, when between 0.0° - 5.0° apply a certain value, when between 5.0° - 15.0° apply another value. However, the relative amount of rotation can be user...
Top