Any suggestion on how to solve this problem using Matlab?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
How plot the function in the picture by using Matlab?![Screenshot_1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/204056/Screenshot_1.png)
![Screenshot_1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/204056/Screenshot_1.png)
1 comentario
Geoff Hayes
el 14 de Feb. de 2019
James - what have you tried so far? This seems like homework so please post what you have attempted and discuss what is causing errors or confusion (for you).
Respuestas (2)
Yasasvi Harish Kumar
el 14 de Feb. de 2019
The below code should be able to plot the required.
m = 25;
mu = 0.55;
g = 9.81;
for t = 0:90
F(t+1) = mu*m*g/(cosd(t) + mu*sind(t));
theta(t+1) = t;
end
plot(theta,F)
0 comentarios
Stephen23
el 14 de Feb. de 2019
Editada: Stephen23
el 14 de Feb. de 2019
I know this is homework, but someone needs to show that it is a waste time writing loops, it is much better to write simple vectorized code:
a.1.
>> mu = 0.55;
>> g = 9.81; % m/s/s
>> m = 25; % kg
>> theta = 0:0.5:90;
>> F = mu*m*g./(cosd(theta) + mu*sind(theta));
>> plot(theta,F)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/204079/image.png)
>> fun = @(t) mu*m*g./(cosd(t) + mu*sind(t));
a.2.
>> t150 = fzero(@(t)fun(t)-150,[40,100])
t150 = 66.818
>> fun(t150)
ans = 150
b.
>> tmin = fminsearch(fun,50)
tmin = 28.810
>> fun(tmin)
ans = 118.19
I am sure that you can manage the last tiny bit yourself.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!