Troubles with plotting two functions in one graph
显示 更早的评论
I am having troubles with the following code:
function polarisatiecurve
P = 100
I = 0:0.0001:200;
U1 = P/I;
U2 = 800*(I+19)^2 - 2*(I+19)^3;
plot(I,U1,'b',I,U2,'r',[0,100,0,600]);
subplot (1,2,1);
xlabel('Stroom (A)')
ylabel('Spanning (V)')
title('Polarisatiecurve')
axis([0 120 0 4000])
grid on
grid on
end
What I want to do is plot two functions in one graph. The terms 'polarisatiecurve, stroom, spanning' are Dutch and mean polarisation curve, current (stroom) and voltage (spanning). What I want is that it plots two functions in the same graph. Both functions depend on the current I (the 'stroom'). However I can't get it to work. It gave me the following error:
Error using / Matrix dimensions must agree.
Error in polarisatiecurve (line 4) U1 = P/I;
That refers to the following line of code:
I tried converting I to a symbolic expression but that didn't work either. Who knows how to fix it?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!