plotting with variable parameter
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mesbahose Salekeen
il 23 Giu 2020
Modificato: Star Strider
il 23 Giu 2020
let's say i want to plot a graph f(x)=x^3+b*x^2+1
but i want to visualize the graph as b changes lets say from -3 to 3 with .5 step. How can i do it?
0 Commenti
Risposta accettata
Star Strider
il 23 Giu 2020
Modificato: Star Strider
il 23 Giu 2020
Try this:
f = @(b,x) x.^3+b.*x.^2+1;
bv = -3:0.5:3; % Define ‘b’
x = linspace(-1, 1, 25); % Define ‘x’
[B,X] = ndgrid(bv,x);
F = f(B,X);
figure
plot(x, F)
lgdb = compose('%4.1f', bv);
lgd = legend(lgdb, 'Location','best')
title(lgd, 'b')
EDIT —
Added plot figure —
.
0 Commenti
Più risposte (1)
Reeshabh Kumar Ranjan
il 23 Giu 2020
Modificato: Reeshabh Kumar Ranjan
il 23 Giu 2020
Hey Mesbahose,
I think this answers your question: https://in.mathworks.com/help/control/ug/build-app-with-interactive-plot-updates.html
0 Commenti
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!