Filter löschen
Filter löschen

using c++ in mATLAB

2 Ansichten (letzte 30 Tage)
fatima hamad
fatima hamad am 15 Apr. 2020
Beantwortet: Ayush Gupta am 3 Jun. 2020
There is something wrong in script #2, The i values that must be save in the speeds array is [4 5 6 7 8 ] once five values are saved it must break, could someone help me please and figure what’s wrong with this code?
Also, I need to plot coefficient of static friction (y-axis) as a function of theta (x-axis) and each time at a angular velocity = speed [4 5 6 7 8 ] /r on the same plot, how to do this?
coefficient of static friction equation is eqn1.
and theta is provided.
  4 Kommentare
darova
darova am 15 Apr. 2020
And what is this for?
fatima hamad
fatima hamad am 15 Apr. 2020
Plot The coefficient of static friction versus theta for [0, 180] for different values (five values) of Ω > Ω???.
Ω??? = sqrt(g/r)
plot between coefficient of static friction in y-axis and theta for [0, 180] in x-axis for five angular velocity in the same plot.
coefficient of static friction in the given code is = x
This is the beginning of the code, can you please help in section two? thank you.
% Section 1 : To solve the two equations in term of cofficent of static
% friction & normal force.
% Variables naming:
% m: Mass of block A, kg.
% r: Radius of the drum, m.
% mu_s: Coefficient of static friction.
% N: Normal force, N.
% w = Angular velocity, rad/s.
% theta: Angular position, rad.
% g = Gravitational acceleration, m/s^2.
% x = mu_s
% y = N
clc
clear
syms theta w g m r x y
eqn1 = y-m*g*cos(theta)-m*r*w^2;
eqn2 = x*y-m*g*sin(theta);
[x,y] = solve(eqn1, eqn2)
% Section 2 : To plot coefficient of static friction vs theta for different angular speed
g = 9.81;
r = 0.7;
theta = (0:0.04:pi);
Angspeed = sqrt(g/r);

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ayush Gupta
Ayush Gupta am 3 Jun. 2020
Try using with this code for section 2
g = 9.81;
r = 0.7;
theta = (0:0.04:pi);
speed = sqrt(g/r);
speeds = [0,0,0,0, 0];
noc = 1;
i =1 ;
while(noc <=5)
pause(1)
if speed < i
speeds(noc) = i;
noc = noc +1;
end
i = i+1;
end

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by