oto

https://cdn.plot.ly/plotly-2.27.0.min.js https://polyfill.io/v3/polyfill.min.js?features=es6 https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js /* Sadece simülasyon kutusunu etkilemesi için ID bazlı CSS */ #nyquist-wrapper { font-family: ‘Segoe UI’, sans-serif; background-color: #f8f9fa; color: #333; padding: 20px; border-radius: 10px; border: 1px solid #ddd; margin: 20px 0; } #nyquist-wrapper .sim-container { display: flex; flex-wrap: wrap; gap: 20px; } #nyquist-wrapper .sim-panel { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } #nyquist-wrapper .sim-left { flex: 1; min-width: 300px; border-top: 4px solid #007bff; } #nyquist-wrapper .sim-right { flex: 2; min-width: 400px; border-top: 4px solid #28a745; } #nyquist-wrapper h2 { margin-top: 0; font-size: 1.2em; border-bottom: 1px solid #eee; padding-bottom: 10px; color: #333; } #nyquist-wrapper .equation-box { background: #fff; border: 1px solid #ddd; padding: 10px; border-radius: 6px; margin-bottom: 15px; text-align: center; min-height: 50px; display: flex; align-items: center; justify-content: center; } #nyquist-wrapper input[type=”text”] { width: 90%; padding: 8px; font-family: monospace; border: 1px solid #ccc; border-radius: 4px; margin-bottom: 10px; display: block; } #nyquist-wrapper label { font-weight: 600; font-size: 0.9em; display: block; margin-bottom: 5px; } #nyquist-wrapper button { width: 100%; padding: 10px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; margin-top: 5px; } #nyquist-wrapper button:hover { background: #0056b3; } #nyquist-wrapper table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 0.85em; } #nyquist-wrapper th, #nyquist-wrapper td { border: 1px solid #dee2e6; padding: 6px; text-align: center; } #nyquist-wrapper th { background-color: #f1f3f5; } #nyquist-wrapper .crit-box { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; padding: 10px; margin-top: 15px; border-radius: 6px; text-align: center; }

Sistem Ayarları

$$ G(s) = … $$
Pay (Numerator): Payda (Denominator):
Kazanç (K): 1.0 (İpucu: Yön tuşlarını kullanabilirsin)
Kritik Kazanç:
ωGenlikFaz

Nyquist Grafiği

function parseInput(str) { let arr = str.split(‘,’).map(s => parseFloat(s.trim())).filter(n => !isNaN(n)); while (arr.length > 0 && arr[0] === 0) arr.shift(); return arr.length === 0 ? [0] : arr; } function polyToLatex(coeffs) { if (coeffs.length === 0) return “0”; let str = “”, n = coeffs.length – 1; for (let i = 0; i 0) str += (c >= 0) ? ” + ” : ” – “; else if (c 0) str += “s”; if (p > 1) str += “^{” + p + “}”; } return str || “0”; } function evalPoly(coeffs, w) { let r = 0, i = 0, n = coeffs.length – 1; for (let k = 0; k {}); // Table let tbody = document.getElementById(‘dataTable’); tbody.innerHTML = “”; [0, 1, 2, 3, “inf”].forEach(wIn => { let row = ““, mag, ph; if (wIn === “inf”) { let rd = (den.length – 1) – (num.length – 1); mag = rd > 0 ? 0 : (rd===0 ? num[0]*K/den[0] : Infinity); ph = -90 * rd; row += `${mag.toFixed(3)}${ph.toFixed(0)}°`; } else { let res = calcG(num, den, wIn, K); row += `${wIn}${res.mag.toFixed(3)}${res.phase.toFixed(1)}°`; } tbody.innerHTML += row + ““; }); // Critical K let crossW = -1, lastIm = 0; for (let w = 0.1; w 0.1 && lastIm > 0 && res.im <= 0 && res.re < 0) { crossW = w; break; } lastIm = res.im; } let cDisp = document.getElementById('critKVal'), cMsg = document.getElementById('critMsg'); if (crossW !== -1) { let Kc = 1 / Math.abs(calcG(num, den, crossW, 1).re); cDisp.innerText = Kc.toFixed(2); if (K < Kc) { cMsg.innerHTML = "Kararlı“; cDisp.style.color = “green”; } else { cMsg.innerHTML = “KARARSIZ!“; cDisp.style.color = “red”; } } else { cDisp.innerText = “∞”; cMsg.innerText = “Hep Kararlı”; cDisp.style.color = “green”; } // Plot let x = [], y = [], txt = []; let wArr = []; for(let i=0; i<2; i+=0.02) wArr.push(i); for(let i=2; i<20; i+=0.1) wArr.push(i); for(let i=20; i { let res = calcG(num, den, w, K); if (res.mag < 100) { x.push(res.re); y.push(res.im); txt.push(`w=${w.toFixed(2)}
M=${res.mag.toFixed(2)}`); } }); let xN = […x].reverse(), yN = y.map(v => -v).reverse(); let trace1 = { x: x, y: y, mode: ‘lines’, name: ‘w > 0’, line: {color: ‘blue’, width: 2}, text: txt }; let trace2 = { x: xN, y: yN, mode: ‘lines’, name: ‘w { let s = document.getElementById(‘kSlider’), v = parseFloat(s.value); if(e.key===”ArrowRight”||e.key===”ArrowUp”){ s.value=(v+0.1).toFixed(1); updateAll(); e.preventDefault(); } else if(e.key===”ArrowLeft”||e.key===”ArrowDown”){ s.value=(v-0.1).toFixed(1); updateAll(); e.preventDefault(); } }); // Sayfa yüklenince başlat (Gecikmeli çalıştır ki Plotly yüklensin) setTimeout(updateAll, 500);