How to write and plot multi-variable piecewise function? (Symbolic Toolbox)
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to write and plot a two-variable piecewise function, f(y1,y2). I have had success plotting a one-variable piecewise function using fplot, and success plotting a normal two-variable function using fsurf.
I now want to use fsurf to plot a piecewise function, but the syntax doesn't appear to work. The original script is below, where apart from y1 and y2, everything else is a constant ie. actual number:
syms y1 y2
g(y1,y2) = Fij(3)*(DTC1i-DTC1o+DT1-DT2) + Fij(4)*(DTC2i-((Tp-DTmin)-y2)+DT1-DT2) - Fij(1)*(DTH1o-DTH1i-DT3+DT4) - Fij(2)*((Tp-y1)-DTH2i-DT3+DT4)
fsurf(g)
The issue is that I have different conditions for y1 and y2. My conditions are that:
If (Tp-DTmin)-y2) < 0, the whole term is zero. Otherwise, it remains untouched.
If (Tp-y1) < 0, the whole term is zero. Otherwise, it remains untouched.
Normally I would use the piecewise syntax of:
g(y1) = (cond,var,cond,var)
But that only appears to work for 1 variable. How do I use the piecewise notation for conditions of different variables?
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!