# How to plot a 4^x and a x^8 function together? I have tried so many things from ezplot to plot and fplot, I am very new to this and I hope anyeone could help me

8 views (last 30 days)
Andrew Setiawan on 29 Jan 2018
Commented: Walter Roberson on 29 Jan 2018
>> fplot(x^8,4^x)
>> ylim([0 10])
>> fplot(x^8,4^x);
>> plot(x^8,4^x)
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
>> x=linspace(-1,1)
x =
Columns 1 through 6
-1.000000000000000 -0.979797979797980 -0.959595959595960 -0.939393939393939 -0.919191919191919 -0.898989898989899
Columns 7 through 12
-0.878787878787879 -0.858585858585859 -0.838383838383838 -0.818181818181818 -0.797979797979798 -0.777777777777778
Columns 13 through 18
-0.757575757575758 -0.737373737373737 -0.717171717171717 -0.696969696969697 -0.676767676767677 -0.656565656565657
Columns 19 through 24
-0.636363636363636 -0.616161616161616 -0.595959595959596 -0.575757575757576 -0.555555555555556 -0.535353535353535
Columns 25 through 30
-0.515151515151515 -0.494949494949495 -0.474747474747475 -0.454545454545455 -0.434343434343434 -0.414141414141414
Columns 31 through 36
-0.393939393939394 -0.373737373737374 -0.353535353535353 -0.333333333333333 -0.313131313131313 -0.292929292929293
Columns 37 through 42
-0.272727272727273 -0.252525252525252 -0.232323232323232 -0.212121212121212 -0.191919191919192 -0.171717171717172
Columns 43 through 48
-0.151515151515151 -0.131313131313131 -0.111111111111111 -0.090909090909091 -0.070707070707071 -0.050505050505050
Columns 49 through 54
-0.030303030303030 -0.010101010101010 0.010101010101010 0.030303030303030 0.050505050505051 0.070707070707071
Columns 55 through 60
0.090909090909091 0.111111111111111 0.131313131313131 0.151515151515152 0.171717171717172 0.191919191919192
Columns 61 through 66
0.212121212121212 0.232323232323232 0.252525252525253 0.272727272727273 0.292929292929293 0.313131313131313
Columns 67 through 72
0.333333333333333 0.353535353535354 0.373737373737374 0.393939393939394 0.414141414141414 0.434343434343434
Columns 73 through 78
0.454545454545455 0.474747474747475 0.494949494949495 0.515151515151515 0.535353535353535 0.555555555555556
Columns 79 through 84
0.575757575757576 0.595959595959596 0.616161616161616 0.636363636363636 0.656565656565657 0.676767676767677
Columns 85 through 90
0.696969696969697 0.717171717171717 0.737373737373737 0.757575757575758 0.777777777777778 0.797979797979798
Columns 91 through 96
0.818181818181818 0.838383838383838 0.858585858585859 0.878787878787879 0.898989898989899 0.919191919191919
Columns 97 through 100
0.939393939393939 0.959595959595960 0.979797979797980 1.000000000000000
>> y=x^8,4^x
Error using ^
One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
>> 4^x
Error using ^
One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
>> 4^(x)
Error using ^
One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
>> fplot(x^8,[-1 2])
Error using ^
One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power.
>> fplot(x.^8,[-1 2])
>> clear all
>> fplot(x^8,[-1 2])
Undefined function or variable 'x'.
>> syms x
>> fplot(x^8,[-1 2])
>> hold on
>> fplot(4^x,[-1 2])
>> plot(x^8,4^x, [-1 2])
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
>> fplot(x^8,4^x, [-1 2])
>> axis([-1 2 0 7])
>> fplot(x^8,4^x, [-1 2])
>> ezplot(x^8,[-1 2])
>> hold on
>> ezplot(4^x,[-1 2])
>> ezplot(x^8, 4^x, [-1 2])
>> plot(x^8,4^x)
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
>> clear all
>> plot(x^8,4^x)
Undefined function or variable 'x'.
>> fplot(x^8,4^x(
fplot(x^8,4^x(
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
Did you mean:
>> fplot(x^8,4^x)
Undefined function or variable 'x'.
>> syms x
>> fplot(x^8,4^x)
>> axis([-1 2 0 3])
>> axis([-100 100 100 100])
Error using matlab.graphics.axis.Axes/set
Value must be a 1x2 vector of numeric type in which the second element is larger than the first and may be Inf
Error in axis>LocSetLimits (line 272)
set(ax,...
Error in axis (line 101)
LocSetLimits(ax(j),cur_arg,names);
>> axis([-100 100 0 100])
>> fplot(x^8, [-1 2])
>> hold on
>> plot(x^8, sin(x))
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
>> plot(x.^8, sin(x))
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
>>
Walter Roberson on 29 Jan 2018
Well if you do not want to see anything above 7 even though it exists in the data, then
ylim([0 7])

Nicolas Schmit on 29 Jan 2018
x=linspace(-1,1,100);
plot(x.^4);
hold on;
plot(x.^8);
hold off