Hello everyone, I am trying to write a function that takes in a value of N and a vector x and run the vector through an if statement to sort the numbers and plot them accordingly. I want all plots on the same graph.
function [ blah] = tanplot( x,N)%UNTITLED Summary of this function goes here
% Detailed explanation goes here
hold onif abs(tan(x)) <= N y = tan(x); plot(x,y)elseif tan(x) > N y = N; plot(x,y,'-m')elseif tan(x) < -N y = -N; plot(x,y,'-r')endhold offtitle('Tan Plot')end
Best Answer