How can I make a variable equal a script in Matlab

1 回表示 (過去 30 日間)
ARAH MIZORI
ARAH MIZORI 2021 年 8 月 30 日
コメント済み: Sahil Jain 2021 年 9 月 2 日
I want to make this script:
c = 4500:30:7500;
first = 0:150;
second = 150:250;
third = 250:325;
x = 0.2*first;
y = c./second;
z = -(0.4)*third+130;
plot(first, x, second, y, third, z)
Be the variable for v in this script:
clc
clear
close all
v = (velocity_array);
s = sumAreaP4(v);
disp (x)
sumAreaP4:
function [s]=sumAreaP4(v)
j=length(v);
t=0.1;
A=0.5*t*v(1);
s=A;
for i=2:j
A(i)=0.5*t*(v(i-1)+v(i));
s(i)=s(i-1)+A(i);
end
end
Thank you
  4 件のコメント
DGM
DGM 2021 年 8 月 30 日
Which array? It's a script with multiple variables. You're essentially asking how to make a function, but you haven't described what the function is even supposed to return.
Sahil Jain
Sahil Jain 2021 年 9 月 2 日
As the other users commented, please provide more details as to which array from the first script you would like to use in the second script.

サインインしてコメントする。

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by