What is wrong with this code?
3 visualizaciones (últimos 30 días)
Prithvi Shams el 12 de Oct. de 2019
I would like to plot the following function
Ao = 0.2, E = 181e9, Beta = 200, Vo = 0.5 and Va = 0.85. The objective is to plot P1 for Vf = 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85
I plotted the graph in MATLAB using the code below, but the graph didn't make sense theory - wise. So I re-did the graph in Excel and it came out fine. I am wondering what I did wrong in my code!
It's obvious from the equation that for Vf = 0.5, the function should return 0. But I am getting a large value like 1.12e6!
Vf = (0.5:0.05:0.85);
P = - ( (0.2*0.5)./Vf).*( (1 - sqrt(Vf/0.5))/( (16/pi^3)*(200^2/181e9).*sqrt(0.85./Vf).*(sqrt(0.85./Vf)-1).^2 ) );
Star Strider el 12 de Oct. de 2019
You forgot to use element-wise division ...
P = - ( (0.2*0.5)./Vf).*( (1 - sqrt(Vf/0.5))./( (16/pi^3)*(200^2/181e9).*sqrt(0.85./Vf).*(sqrt(0.85./Vf)-1).^2 );
That worked when I ran it.