I want to solve a simple "y=mx+c" with initial condition to find value of "m" and "c" but i am getting error by using following code. Any idea to tackle this kind of problem?

3 ビュー (過去 30 日間)
Amit kumar
Amit kumar 2023 年 3 月 3 日
回答済み: Alan Stevens 2023 年 3 月 3 日
clc
clear all
close all
syms a b x
y=a*x+b
cond1=y(0)== 1
cond2= y(1)== 0
conds=[cond1 cond2]
y_1=solve(y,conds)

回答 (1 件)

Alan Stevens
Alan Stevens 2023 年 3 月 3 日
These are simple linear equations in m and c so set:
X = [x(1) 1; x(2) 1];
Y = [y(1); y(2)];
and solve using
X\Y
to get m and c.

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by