Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to plot continous function with different definations

1 visualización (últimos 30 días)
Nikhil
Nikhil el 4 de Oct. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello all, I want to plot variation of function P(x) over range of x from -10 till 20 where P(x) is defined as P(x)= 0 if x<=0; =x if 0<=x<=1; =2-x if 1<=x<=2; =0 for x>2;
for this I have written following code: clear; dx=0.5; x=-10:dx:20; function z = bilinear(x) if x>=2 z=0; elseif 2>x>=1 z=2-x; elseif 1>x>=0 z=x; else z=0; end fp=bilinear(x); plot(x,fp);
and matlab is giving me following error: ??? Error: File: Q2.m Line: 3 Column: 1 Function definitions are not permitted in this context.
Can somebody please help me to debug this,
Thanks in advance,
Nikhil

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by