Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why isn't the program run?

조회 수: 1 (최근 30일)
MA
MA 2014년 6월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
clear all
clc;
syms x
f=sym(zeros(3,1));
g=sym(zeros(3,1));
h=sym(zeros(3,1));
f(1)=x;
f(2)=x^3;
f(3)=2;
g(1)=1;
g(2)=x;
g(3)=x^2;
h(1)=abs(x);
h(2)=sin(x);
h(3)=-abs(x);
ff = matlabFunction(f);
gf = matlabFunction(g);
hf = matlabFunction(h);
x = 0:0.5:10;
fgh = [ff(x)' gf(x)' hf(x)'];
figure(1)
for i = 1:3
subplot(3,1,i)
plot(x, fgh(:,i+[0 3 6]))
grid on
xlabel('x')
title( sprintf('Plot of f_{%d}, g_{%d}, h_{%d}', [i i i]))
end
  댓글 수: 4
MA
MA 2014년 6월 9일
really i don't khnow,i only change functions and then didn't work
MA
MA 2014년 6월 9일
i take screenshot from it's error

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2014년 6월 9일
ff = @(x)[x(:),x(:).^3,repmat(2,numel(x),1)];
gf = @(x)[ones(numel(x),1),x(:),x(:).^2];
hf = @(x)[abs(x(:)),sin(x(:)),-abs(x(:))];
x = 0:0.5:10;
fgh = [ff(x) gf(x) hf(x)];
figure(1)
for i = 1:3
subplot(3,1,i)
plot(x, fgh(:,i+[0 3 6]))
grid on
xlabel('x')
title( sprintf('Plot of f_{%d}, g_{%d}, h_{%d}', [i i i]))
end
  댓글 수: 2
MA
MA 2014년 6월 9일
if we just know that f(1),f(2),f(3)....h(3) exist and they are function of x variable we don't khnow their criterion,how do i supposed to do?
Andrei Bobrov
Andrei Bobrov 2014년 6월 9일

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by