How to plot 4 curves with different constants?

조회 수: 1 (최근 30일)
Gregory Grozdanis
Gregory Grozdanis 2022년 9월 23일
답변: Torsten 2022년 9월 24일
I want to plot y = (C - x)/(1+x^2) with 4 different values of C where C is always an integer. I know I can just define 4 different functions but I'm looking for a way to define y as written and define C as an array or something and plotting y with different C values.

답변 (1개)

Torsten
Torsten 2022년 9월 24일
y = @(C,x) (C-x)./(1+x.^2);
C = [1 2 3 4].';
x = -2:0.1:2;
plot(x,y(C,x))

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by