How to show a equation?
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi MATLAB Community,
I Would to show a equation in the follow expression :
T = a1*f1+a2*f2+a3*f3+...+an*fn.
The vector there are all coeficient (a) and also the matriz (f), (depend of result the code previously).
I would to have a idea, how to build a structure, for take the value present in vector (a) and matriz (f), and show the equation example before. (The quantity of element can be different).
%Example:
a = [ 1 2 3] %vector of coefficient (in this case n=3)
T = 1.*F1+2*F2+3*F3; % Equation built
Could help me?
Thank you.
Guilherme
댓글 수: 0
채택된 답변
John D'Errico
2019년 2월 24일
X = sym('X',[1,3]);
coeff = rand(1,3);
vpa(sum(X.*coeff),5)
ans =
0.022414*X1 + 0.053832*X2 + 0.14087*X3
댓글 수: 1
Afifah Shabrina
2020년 11월 3일
clc;
clear all;
data = load('hypodd.reloc');
x = data(:,3); %Bujur
y = data(:,2); %Lintang
z = data(:,4); %Kedalaman Gempa
A = [x y ones(length(x),1)];
[cc,bint,r,rint,stats]= regress(z,A);
% PLOT PEMODELAN
scatter3(x,y,z);
hold on;
x_grid=119:0.05:120;
y_grid=-3.2:0.05:-2.2;
[XFIT, YFIT]=meshgrid(x_grid, y_grid);
AFIT=cc(1)*XFIT+cc(2)*YFIT+cc(3);
surf(XFIT,YFIT,AFIT);
set(gca,'ZDir','rev')
% LABEL
title('\fontsize{14}Model Bidang Sesar Bedasarkan Hiposenter Gempa');
legend('Hiposenter',1);
xlabel('Longitude')
ylabel('Latitude')
zlabel('Depth in Kilometers')
Hello, can you help me to show the equation of AFIT=cc(1)*XFIT+cc(2)*YFIT+cc(3) this?
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!