필터 지우기
필터 지우기

please help me with matlab

조회 수: 3 (최근 30일)
Boss Man
Boss Man 2019년 12월 23일
댓글: Image Analyst 2019년 12월 24일
%matrix a of indoor temp
%matrix b of outdoor temp
t=5
for i=1:8590
dt=(a(i+1)-a(i))/t
c=dt/b(i)-a(i)
plot(c)
not great at matlab
aim is to produce a graph of a constant that varies over time. although i dont know how to add the data file into the matrix?
once ive added the matrix, does this code run and will it produce a graph of c as an output
thanks for any help
  댓글 수: 1
Stephen23
Stephen23 2019년 12월 23일
"...although i dont know how to add the data file into the matrix?"
What "data file" ? You don't mention any files anywhere else in your question.
You probably don't need a loop, take a look at diff and element-wise division.

댓글을 달려면 로그인하십시오.

답변 (1개)

David Hill
David Hill 2019년 12월 23일
Assuming matrixes a and b are the same size.
dt=diff(a)/5;
c=dt./(b(1:end-1)-a(1:end-1));%diff(a) will be one less than matrix a and b
plot(c);
Yes, it plots c.
  댓글 수: 3
David Hill
David Hill 2019년 12월 24일
Please provide a copy or example of your data file. Do you not know how to load the data file into matlab?
Image Analyst
Image Analyst 2019년 12월 24일
You forgot to attach your data file. Please attach it. In the meantime, try importdata(), readtable(), dlmread(), csvread(), readmatrix(), xlsread(), etc. to read in your data file.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by