
Math Software Math Software  Mathematica, Matlab, Calculators, Graphing Software 
 LinkBack  Thread Tools  Display Modes 
December 3rd, 2018, 06:06 PM  #1 
Newbie Joined: Oct 2018 From: Turkey Posts: 23 Thanks: 0  matlab plotting and defining range
I have the function in Matlab: y=(2*cos(x)^21)/cos(x) All i want is a simple plot of this. i want x to be from pi to pi for example so i wrote x = pi : pi But when i said plot (x,y) Matlab says: "Error using plot Data must be numeric, datetime, duration or an array convertible to double" Where am i making a mistake? 
December 6th, 2018, 02:01 PM  #2 
Senior Member Joined: Feb 2016 From: Australia Posts: 1,798 Thanks: 634 Math Focus: Yet to find out. 
If you want a numeric plot, youâ€™d need to pass x into y first to create a vector. Alternatively you can set x to be symbolic (syms x) and then use fplot(y).


Tags 
defining, matlab, plotting, range 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
need help in defining a function  janeryk  Trigonometry  1  April 25th, 2016 04:15 AM 
Need help defining a function  willeb96  Algebra  9  July 20th, 2014 01:27 PM 
Defining functions  Mr Davis 97  Calculus  1  May 11th, 2014 05:51 PM 
Plotting simple sound source Matlab  jellicorse  Math Software  0  March 24th, 2014 01:27 PM 
Calculating a position in a range while limiting the range  tale  Computer Science  5  May 23rd, 2012 05:16 AM 