0

I have a problem with the following MATLAB code:

E=1.15*10^5; 
h=0.35; 
b=50; 
l=75; 
i0=(b*h^3)/12;
f=0:1:10; 
P=[0 0.1 0.2 0.3 0.3 0.4 0.6 0.7 0.8 1.1 1.4];
Pt=(E*2*10^5*f)/l^3;

plot(f, P,'k','LineWidth', 2, f, Pt, '-.k', 'LineWidth', 2); grid; 

xlabel('Sageata f[mm]'); 
ylabel('Forta P[N]'); 
legend('P',  'P_t'); 
title('Caracteristica arcului triunghiular'); 

Error using plot

Invalid first data argument

First of all, what is k and -k and why my is plot not working without them? Secondly why do I only have one line?

2
  • 1
    please use code formatting (the fat {} button atop of the question editor) instead of these empty lines. Don't but multiple statements on one line - that's only confusing, and you don't pay per line. Commented Mar 7, 2022 at 11:59
  • For your first question, check the doc about LineSpec Commented Mar 7, 2022 at 17:53

1 Answer 1

1

If you want tight control of line parameters, its much better to just separate each line you want to plot in a separate plot call.

hold on
plot(f, P,'k','LineWidth', 2)
plot(f, Pt, '-.k', 'LineWidth', 2); 
grid; 
hold off
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.