How can I plot an equation in the form y=mx+c
6 views (last 30 days)
Show older comments
I want to plot an equation where t1=p*t2+g , i have already defined what p and g are and both t1 and t2 are vectors of size 8x1, i tried ezplot('p*t2+g') but i get errors including saying t2 isn't defined, something about inline/feval and other malarkey. tbh im new to matlab so any help wouldn't go amiss, thanks.
0 Comments
Answers (2)
Star Strider
on 28 Nov 2015
If you already have ‘t1’ and ‘t2’, you can plot them directly:
figure(1)
plot(t2, t1)
grid
7 Comments
Star Strider
on 28 Nov 2015
You have to present it to ezplot as an ‘anonymous function’ as I did (see the documentation for ezplot for details), along with correct values of ‘p’ and ‘g’ and the correct range of values (minimum and maximum) for ‘T2a’.
Image Analyst
on 28 Nov 2015
You know that MATLAB is case sensitive, don't you? T2 is different than t2. You have to use the same capitalization if you want them to be the same variable.
I never use ezplot() - I just define t2 so I know what it will be rather than trust that function to select a range that I may or may not be happy with.
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!